Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Auto Fit to markers in Google Map Web Part View modes: 
User avatar
Member
Member
tpatrick@hawkeyeww.com - 3/13/2012 2:49:46 PM
   
Auto Fit to markers in Google Map Web Part
I'm building a store locator in Kentico and I'm trying to figure out how to have the map zoom/location automatically adjust to fit those markers inside the viewport. I've been scanning the forums/blogs/google for several days now and haven't been able to come up with anything useful.

I've written store locators in the past so I know the Google Maps API has functions to help do this. The problem is, I can't find a good way to tie into the Kentico map web part and accomplish it. I could add the javascript calls directly to the .js in \Kentico\CMSWebParts\Maps\Documents\GoogleMaps_files\GoogleMaps.js. But I don't know have a guaranteed way to tell that all the markers have been placed. I would have to do the auto-fit EVERY time a map marker is added and performance would suffer.

Is there anyway to adjust the code that generates the BasicGoogleMaps object and accomplish this? Or is there some property setup that I'm missing? Any input would be helpful.

User avatar
Kentico Support
Kentico Support
kentico_janh - 3/14/2012 7:58:02 AM
   
RE:Auto Fit to markers in Google Map Web Part
Hello,

Regrettably, the addGoogleMarker() method is the only method, which is called from the sourcecode (which is harcoded into DLL files), so there is no way in a current version, how to run a script after all markers are placed.

Best regards,
Jan Hermann