Can anyone tell me why this kml file won't display on google maps?
Im using the following code to add it to the map object which seems to work fine with other kml files.
var kml = new google.maps.KmlLayer('.kml');
kml.setMap(map);
Feed validator says its valid and it isn't too big for googles servers to parse?
The map just zooms right into the ocean!
Can anyone tell me why this kml file won't display on google maps?
Im using the following code to add it to the map object which seems to work fine with other kml files.
var kml = new google.maps.KmlLayer('http://www.emotination./kml/tasman.kml');
kml.setMap(map);
Feed validator says its valid and it isn't too big for googles servers to parse?
The map just zooms right into the ocean!
Share Improve this question edited May 1, 2012 at 23:36 mmmmmm 32.7k28 gold badges91 silver badges122 bronze badges asked Feb 17, 2012 at 3:43 kmb64kmb64 1,5132 gold badges17 silver badges29 bronze badges 4- This should work, can you post a link to your live code, or put it in a jFiddle? – Mano Marks Commented Feb 17, 2012 at 20:01
- It does seem to work now, I tried running it again the next day. Im still confused though because I didn't change anything. All I can think of is that it would be something to do with googles servers cacheing an older copy of the kml file – kmb64 Commented Feb 17, 2012 at 21:51
- 2 You are correct that the kml files are cached. You can get around that problem by add a timestamp parameter to the url (so the google server will consider it as a different file). I.e. 'emotination./kml/tasman.kml?time='+new Date().getTime(); – Björn Commented Feb 19, 2012 at 16:24
- Please post the gist of the ments as an answer and mark this question as answered. – Sean Mickey Commented May 1, 2012 at 22:53
1 Answer
Reset to default 8You need to ensure Google's servers aren't displaying a cached copy of your kml file
A good way to do this is to do what Björn suggests in his ment and just add a timestamp so the end of the url:
var kml_tasman = new google.maps.KmlLayer('http://www.emotination./kml/tasman.kml?time='+new Date().getTime());
kml_tasman.setMap(map);