Reading GoogleMap zoom level


Hi, I’m converting a map application from VWG to WiseJ. In VWG, you could read the .MapZoomLevel property — is it possible to read the current zoom level in WiseJ?

I can set it by calling Me.mobjGoogleMap.Options.zoom = 19, but if I check the Options.Zoom value, I get System.MissingMemberException : Public member ‘zoom’ on type ‘DynamicObject’ not found.


‘Only zoom and redraw if necessary.
If Me.mobjGoogleMap.Options.zoom <> 19 Then
Me.mobjGoogleMap.Options.zoom = 19 ‘ high zoom level
End If

  • You must to post comments
Best Answer

Hi Andrew,

The GoogleMaps extension allows you to read/set any property in the google maps widget without having to map them to a specific C# property, this gives you maximum flexibility with the google maps oobject. The Options object is a Wisej DynamicObject which is basically identical to a JavaScript object but on the server.

However, such a dynamic object doesn’t have any of the initial values unless you initialize those values. When you try to read the zoom property before it’s initialized it simply doesn’t exist. You can check if it exists by comparing to null (or Nothing in VB) or by using the null operators, in VB it’s the If expression: If (nullable, valueIfNull), or  in C# var zoom = Options.zoom ?? 4. In VB.BET Dim zoom as If (Options.zoom, 4) (or something like this).

Another way is to simply set the initial options on your google maps object including the zoom, like the example linked below.

You can also detect live when a property is changed by the user by attaching to MapPropertyChanged event. The event args carry the property name and the new value. I tried the example we have online ( and when I zoom the map I get the MapPropertyChanged event and I can also read the new zoom value like this: this.googleMap.Options.zoom.




  • You must to post comments

Thanks for the info, Luca.  I’ll keep experimenting with the extension.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.