Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)

#1 2012-06-13 04:29:50

degt
Member
Registered: 2012-05-15
Posts: 33
Website

Add KML Layer pitfalls

I have been playing around with GMap and KML on my ASP.NET MVC3 website. I noticed the example used full URLs yet on my tests it didn't work until several tries. These were my findings with regards to the GMAP3 addKmlLayer URL option:

- You can't use a shortened URL relative to the root such as /Public_Files/KML/Sample.kml it won't render
- You can't use a full localhost URL, won't render either:   http://localhost:8035/Public_Files/KML/Sample.kml
- It has to be a full LIVE URL somewhere on the net   http://www.mysite.com/Public_FIles/KML/Sample.kml

Maybe that information could be placed on the example in hopes of saving somebody's times trying to figure it out :-) I am glad I got mine working.

Offline

Ads
(server costs 27.50€ per month)

#2 2012-06-13 04:39:06

degt
Member
Registered: 2012-05-15
Posts: 33
Website

Re: Add KML Layer pitfalls

By the way... I noticed that in the example when you enable a checkbox that displays a KML layer it causes the map to automatically zoom in/out to encompass the enabled area. Is there a way to disable that behaviour? If I have several items displayed I want the user to have a better overview of the "new" KML layer with respect to the others, if it automatically zooms in then you lose that overview and have to manually zoom out to get your bearings again.

Offline

#3 2012-06-13 17:55:32

charlietfl
Moderator
Registered: 2011-11-24
Posts: 201

Re: Add KML Layer pitfalls

have you investigated the preserveViewport option in maps API?

https://developers.google.com/maps/docu … /reference

Offline

#4 2012-06-13 22:04:14

degt
Member
Registered: 2012-05-15
Posts: 33
Website

Re: Add KML Layer pitfalls

Thanks that indeed resolved the issue. To be more clear, I added the preserveViewport: true to the addKmlLayer options.

Offline

Board footer

Powered by FluxBB