On 13/05/2009, idiot <[email protected]> wrote: > > That's what I figured. I put the file on a beta server and the code > on a dev server and it worked. > > A followup question if anyone knows (can't find any answers to this > online): Say I want to grab the lat/longs from that kml overlay and > tie them together with loadFromWaypoints to get directions. How would > I go about that? I know how to use loadFromWaypoints but I don't know > how to get the data from a "My Maps" kml file in order to pass it to > loadFromWaypoints. > > I saw an example of something similar attempting to get "marker" tags > from xml with GDownloadUrl and GXml .parse, but I don't get any > markers back when I try it. I think it is because the real kml file > is in a NetworkLink tag inside the kml from My Maps, but I'm not sure.
You can just get the KML data by going to the destination of the network link. (Its just a URL to the KML file, nothing more) But GDownloadUrl can only fetch data from the same domain as the script. (it uses XMLHTTPRequest under the hood) (GGeoXML gets round this by a proxy on their server that transforms KML to JSON) So you can do the same and have a proxy on your server that fetches the KML and returns it to the browser (either as KML which can be decoded by javascript - EGeoXML or GeoXML are ready made KML parsers, or returns it a simplified format like JSON) > > > On May 13, 3:23 pm, Barry Hunter <[email protected]> wrote: > > On 13/05/2009, idiot <[email protected]> wrote: > > > > > > > > > That did it, thanks! > > > > > But it raises a question: What if the server is not accessible from > > > outside of the network, like a dev server for example? > > > > Then it won't work! > > > > As the final map needs to be publicly accessible other than during > > development it should be a moot point. > > > > > > > > > > > > > On May 13, 3:14 pm, Barry Hunter <[email protected]> wrote: > > > > Try giving a full URL to the file. > > > > > > (the KML is fetched by Googles server, so it needs a full url. > > > > > > On 13/05/2009, idiot <[email protected]> wrote: > > > > > > > I can't get maps saved from My Maps to work in the API. I am using > > > > > GGeoXml. It seems to work with some example KML files I find > online, > > > > > but not the ones I save from My Maps. I save them using the "View > in > > > > > Google Earth" link (as I don't see any other way to save a KML file > > > > > from My Maps). > > > > > > > The map I am testing is > here:http://planetidiot.com/maptest/test.html > > > > > > > The "My Map" is a public map here: > > > > > > > > http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=1019615796943... > > > > > > > There are no javascript errors in firebug and the map seems to > > > > > function fine, but there's no overlay from the KML. > > > > > > -- > > > > > > Barry > > > > > > -www.nearby.org.uk-www.geograph.org.uk- > > > > -- > > Barry > > > > -www.nearby.org.uk-www.geograph.org.uk- > > > -- Barry - www.nearby.org.uk - www.geograph.org.uk - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
