9

Can anyone tell me how I could add the functionality as seen on google maps that allow users to specify a URL to a KML file in the search bar?

I would like to include this in my own embedded map but I'm really lost on how to execute it.

I've seen examples for KML URL search on other sites but they don't seem to work. Maybe google has dropped this feature from embedded maps/api3 maps?

2
  • seems it is removed from Google Maps - the main search still retrieves kml example search:'airspace filetype:kml'
    – Mapperz
    Commented Dec 14, 2012 at 14:54
  • That's a shame, really need a feature like this for an app I'm trying to put together. The weird thing is that I was able to add the url of the kml file I wanted to use in google maps main search bar and it retrieved the data without any issue. I guess it must have just been dropped from the API. Do you know of any other "fairly simple" way to allow users to add a kml file to an embedded map. I would have no problem adding server side scripts to do it and having a button on the map execute the upload I just don't know what I would need to do it.
    – Vincent
    Commented Dec 14, 2012 at 15:28

4 Answers 4

1

You can use an iframe:

<iframe width="425" height="350" frameborder="no" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=nice&ie=UTF8&z=11&iwloc=addr&om=1&ll=43.76068,7.299728&output=embed&s=AARTsJotOehFyV7Ld4EHPP1WtrZKl2G9Tw"></iframe>

Examples: Google Maps Google Maps + KML

0

You can open up data that you want for your own map into QGIS and then convert it to KML through QGIS before saving it to your computer. Then, while opening Google Earth, you can upload and then add your new map data as a new layer

1
  • Welcome to GIS SE! Unfortunately, I think that your QGIS/Google Earth Answer does not directly address the Question which is about Google Maps. Hopefully, people will not downvote this while you are new to the site but if they do I hope you will see that as a "lesson learned".
    – PolyGeo
    Commented Feb 28, 2014 at 0:03
0

The API gives you the KmlLayer class, which "creates a KmlLayer which renders the contents of the specified KML/KMZ file". Just pass the URL you're given in the KmlLayerOptions.

0

All I do is add my kml/kmz url as an argument to google maps ... like this:

http://maps.google.com/?q=http://www.garrettcounty.org/resources/planning-land-development/pdf/Maps/2005tilegrid.kmz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.