Is it possible to add a kml but center the map to another location?

115 views
Skip to first unread message

az

unread,
Jul 18, 2011, 10:54:13 AM7/18/11
to google-map...@googlegroups.com
I have a kml containing some points, its center is say, lat 45 long 50
When I first initialize the map i do it with coords lat 40 long 10, but it always centers itself on the kml's center.
Is it posible to make the map center on 40,40 even if the kml is not visible in this extent?

geoco...@gmail.com

unread,
Jul 18, 2011, 11:06:01 AM7/18/11
to Google Maps JavaScript API v3

samsoe

unread,
Jul 18, 2011, 1:32:15 PM7/18/11
to google-map...@googlegroups.com
just add preserve viewport

var kml_layer = new google.maps.KmlLayer('http://some.kmz', {preserveViewport: true}); 

az

unread,
Jul 19, 2011, 6:19:02 AM7/19/11
to google-map...@googlegroups.com
Hi
I tried this but it doesnt show the kml file.
the map is centered over 25 east, there is a 3 point kml in britain (around -2W and 52 N) but it is not shown.
What am I doing wrong?

az

unread,
Jul 19, 2011, 6:26:07 AM7/19/11
to google-map...@googlegroups.com
is this the exact syntax?
var ctaLayer = new google.maps.KmlLayer('http://garnet2k.dyndns.org:8080/people1.kml', '{opts?preserveViewport: true'});

az

unread,
Jul 19, 2011, 6:33:59 AM7/19/11
to google-map...@googlegroups.com
Disregards the above, I got it working,

kml_layer = new google.maps.KmlLayer('http://some.kmz', {preserveViewport: true}); 
my bad :)
Thanks
Reply all
Reply to author
Forward
0 new messages