2

My goal is let a user draw a route so they can submit it to the site.

In the following jsfiddle, a user can draw a route and double-click when finished. Double-click will bring up a Google Form with 'Location' field pre-populated with the KML coordinates. The user can submit it, and it goes to a Fusion Table for easy display down the line once it is approved.

Here is the jsfiddle. And the code:

      //here is the variable with properly formatted KML 
  geolines=escape("<LineString><coordinates>")+poly.getPath().getArray().toString().replace(/([\s]+)/g, '')+escape("</coordinates></LineString>") ;

  //infowindow that should display a form with Location field pre-populated with geolines variable for easy submission.
infowindowv2 = new google.maps.InfoWindow({
        content: '<iframe width=600 height=300 scrolling=yes frameborder=no seamless src=https://docs.google.com/spreadsheet/embeddedform?formkey=dDN6WEJTMlNHT2VNMlZBOW1MZmI1Wnc6MQ&entry_0=Test1&entry_1='+ geolines +'&entry_2=test3%22 seamless></iframe>'
});

The problem is that if one zooms out and draws a more complicated route, the KML becomes too large very quickly and I get the following error: "413. That’s an error. Your client issued a request that was too large. That’s all we know." See here.

Now I am struck thinking about how I should get around it.

I like the way maps/forms/fusion tables work together and I would like to preserve this combination, but I am not sure how.

Any leads, ideas, suggestions would be appreciated. Thank you for looking.

Matthew
  • 9,851
  • 4
  • 46
  • 77
RIDER
  • 159
  • 3
  • 9

1 Answers1

1

The error has to do with passing the data as part of the URL query string (which has a limit of about 2000 characters: What is the maximum length of a URL in different browsers?). You will need to pass this information as part of a form post with all the data passed as a form element (i.e. your geodata becomes a form 'field' which you post to the URL). There will be no way to pass an arbitrarily lengthy URL like this.

EDIT fixed my original post to make sense.

UPDATE This post seems relevant, it is just the issue of getting data to your iframe: Pass value to iframe from a window

or this: Pass jquery variables between iframe and parent

Basically, manipulate the frame element from the main window - I think this should work in your situation. If you get it working you should post the resultant jsfiddle - neat tool.

Community
  • 1
  • 1
Matthew
  • 9,851
  • 4
  • 46
  • 77
  • Yup, I'm just not sure hot to proceed to solve it. Use Fusion Tables API? Or somehow use javascript to wait for the form to popup empty, and then insert the data into the correct Form element? Or perhaps something else? – RIDER Jan 18 '13 at 22:57