detecting Google Map center change


If a user pans/moves to a different location in my GoogleMap, and I want to change to a Satellite View by updating GoogleMap.Options:

Me.mobjGoogleMap.Options.mapTypeId = “satellite”

It reloads the map options, and goes back to the original “center”.

This is annoying because I don’t want them to lose their place.

I thought it would automatically update the Options.Center property when moving the map location, but this isn’t true.


How can I detect when the user pans the map location, and update center accordingly?

the MapPropertyChanged event does not seem to update for panning/moving, but it does fire when the zoom level is changed.

Should WiseJ implement this method?

and will it return the “current” center or the original one?







  • You must to post comments

OK, I figured out that I need to pass the WiseJ GoogleMap widget into external Javascript, because “Google doesn’t provide any way to retrieve a map from an id or an element.” (Luca 4/27/18)

External Javascript:

//pass in a WiseJ googlemap object. call getbounds on it and return value
function getMapBounds(googleMap) {
var map =;
return map.getBounds();



”Call gmapHelper javascript, function getMapBounds. Pass in our GoogleMap WiseJ widget, have a callback that can access the return value.
Application.Call(“window.getMapBounds”, Sub(a As Object)

End Sub, Me.mobjGoogleMap)


I imagine I can do the same thing with .getCenter() , and I’ll have to detect when it might be updated by some other event than MapPropertyChanged().

So I think this might be sufficient, but I definitely appreciate you guys updating and continuing to improve the WiseJ GoogleMap component so it is as useful as possible



  • You must to post comments

On another note, it would also be useful to know the boundary of the map viewport at any given point in time.  This can be done in Javascript by calling map.getBounds()

Question is, what’s the best way to make use of that server side?

I know how to call it in an external JavaScript file, and then pass the value back in a WebMethod, but that would be a somewhat sloppy way of doing it as it would interrupt the flow of code.

Should I use a Javascript extender , with callback Action(Of Object) like

mobjGoogleMap.Call(“this.getBounds()”, Sub()
(somehow receive the LatLng result object here?)
End Sub)


I tried this and got a stack overflow.
mobjGoogleMap.Call(“this.getBounds()”, Sub(latLngAs Object)

End Sub)



thanks for bearing with me.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.