KML overlay as string - google-maps

Is there any way to create a KML overlay in Google Maps by passing the KML as a string rather than as a publicly accessible URL? AFAICT there is no such option in the Google Maps API v3. I am not asking about the API but about possible end runs around this limitation.
Personally I can think of only one: to parse the KML and generate equivalent JS. Does anyone have a better suggestion?

geoxml3 has a parseKmlString method, which will parse a string of kml and can create native google maps API v3 objects from it. I have used it to parse kml fragments out of FusionTables.

I've tried too but i haven't found a way to do this.
The reason is explained here: https://stackoverflow.com/a/6152916/2131283
For the tests my work around was sharing the kml file on my dropbox then give the direct access url with the token to the constructor
kmlLayer = new google.maps.KmlLayer
url: 'https://dl.dropboxusercontent.com/s/eg/gmaps.kmltoken_hash=HASH_CODE&dl=1'

Looking over the API it doesn't appear that this is possible.

Related

kml to encoded polyline/polygon

The utility at http://www2.warrensburgr6.org/boundary/encoder/#details is good for converting kml files to encoded polylines for use with the Google Maps Javascript API v2. But I notice it no longer works for polygons. So I have two questions:
1) Is there anything equivalent for the Google Maps v3 API?
2) Is it still possible to use encoded polygons with the Google Maps v2 API? If so, how?
And before anyone asks, yes I know it's possible to display kml data directly. But due to the size of the files, I don't want to do so.
Question effectively withdrawn, as I've now managed to hack the encoder utility to produce v3 code.
(I'd still be interested to know whether the v2 API wrapper can be made to display the polygons, but that's really just idle curiosity).

How to get the json file from an existing google map

I need to create a custom google map search tool. So i use google map API.
I'd like to know if it's possible to get the JSON from an other map build from the native google map managment system such as this one :
https://www.google.com/maps/d/viewer?mid=z7YNZSDcNAU0.kviSuto4ltCY
I want my client still use the managment system he knows.
Thanks for your precious help.
So i answer my own...
It's not possible. But in a way we can do this.
- Download the KML
- Use the google map geocoder to rebuild the lat & lng of all your point using the adress. (use a loop for example).

Can I display some KML on a Google Map?

Is it possible to have some KML hardcoded into some Html page and have google maps display that hardcoded KML to a google map?
Right now, I keep seeing documentation that requires the KML to be located somewhere else -> an HTTP endpoint on some webserver (which is not what I want).
Any ideas?
The geoxml3 KML parser will parse a KML string embedded in your page and display it on the map (as native Google Maps API v3 objects, not a KmlLayer, that does require a publicly available KML file).

Google maps (API v3) with kml layer. how to hide kml URL?

I would like to di splay a Google Map with a kml inside through API v3. the proble is that every one can see the url of the kml and easily download it. Is there a trick to 'hide' the .KML URL?
wikimapia.org seems to do something similar displaing kml polygons but if you check with Firebug through the script tag you won't see the kml URL.
thanks everyone for help.
A. from Italy.
You could generate it at run time, so that the server sends the page the URL. However, it is still discoverable at some point. Security through obscurity just doesn't really work. The KMLLayer Layer requires your KML to be on a public server. You could instead parse the KML and render it that way, say using egeoxml. However that delivers much less performance.

pass KML to Google Maps

i found out that i can open google maps with a linkt to a kml-file like that:
http://maps.google.com/maps?q=http://econym.org.uk/gmap/example1.kml
that is exactly what i need, but i don't like to provide a public URL with the Data. Is it possible to pass the data with a post request or get parameter?
Or has anybody another idea how to create a link to google maps with multible markers?
Thanks in advance
Updated based on your comment: You could upload the KML to a Google My Map: maps.google.com->My Places->Create Map->Import. There isn't currently programmatic access to My Maps. Otherwise, maps.google.com requires a public server to host the KML data.