[Google Maps Mobile] Ignoring zoom level

[Google Maps Mobile] Ignoring zoom level

  
Forge Component
(11)
Published on 11 Oct by Labs
11 votes
Published on 11 Oct by Labs

Hi,

The map works fine for most cases, we have a situation that is not working though. We want to set the map's location programmatic by obtaining the Lat & Long through GPS or the user types in an address then we convert to Lat&Long by using Google Web Service. When the Lat & Long changes then the map does change its position to that new location, but the zoom level is ignored and overriden by the Lat & Long parameter changes. Even though the Zoomlevel parameter's value has not changed it is always set to 22 (not a valid value, max zoom is 21). For example the current zoom level on the mao is 16, then the user clicks the button for "Get location by GPS" then when the new Lat & Long values are set the map updates and the zoom level value has not changed and yet the map zooms in super much and I get the zoom level then it is 22. The zoom level parameter that is assigned to the map still has a value of 16. At the end of the Lat & Long update I call "SetZoom" and this does not help. In the end I went into the GoogleMapMobile plugin and in Map_OnParametersChanged right at the end I added SetZoomLevel, I attach screenshot below. A solution to this would be great please.

Further changes I made: I needed OnClick event and also OnZoomChanged. When user clicks on map I want to drop a pin there and read the Lat & Long. So additional event handlers would be a help.

Currently I cloned the plugin with my changes as not to have it overwritten by an update. If this is updated please it will be greatly appreciated if you drop us a notification.

Thanks!

Hi Elize,

I must say that i didn't experienced the issues that you mentioned.

I built a quick example (Map Events screen) where you can find:

  • Query Google maps API (Address -> Coordinates) and add a marker on new position (Lat,Lon)
  • While adding this new marker, the zoom didn't changed
  • Get My location button has some hardcoded location so I don't have to use the location plugin
  • Added event MapZoomChanged and the handler (If you zoom, you'll see a feedback message)
  • Added event MapOnRecenter and handler as the above

You can see the google maps events documentation and implement them as it is on the example. Didn't tried the OnClick though.

Let me know if it works.

Cheers,

Henrique

Elize van der Riet wrote:

Hi,

The map works fine for most cases, we have a situation that is not working though. We want to set the map's location programmatic by obtaining the Lat & Long through GPS or the user types in an address then we convert to Lat&Long by using Google Web Service. When the Lat & Long changes then the map does change its position to that new location, but the zoom level is ignored and overriden by the Lat & Long parameter changes. Even though the Zoomlevel parameter's value has not changed it is always set to 22 (not a valid value, max zoom is 21). For example the current zoom level on the mao is 16, then the user clicks the button for "Get location by GPS" then when the new Lat & Long values are set the map updates and the zoom level value has not changed and yet the map zooms in super much and I get the zoom level then it is 22. The zoom level parameter that is assigned to the map still has a value of 16. At the end of the Lat & Long update I call "SetZoom" and this does not help. In the end I went into the GoogleMapMobile plugin and in Map_OnParametersChanged right at the end I added SetZoomLevel, I attach screenshot below. A solution to this would be great please.

Further changes I made: I needed OnClick event and also OnZoomChanged. When user clicks on map I want to drop a pin there and read the Lat & Long. So additional event handlers would be a help.

Currently I cloned the plugin with my changes as not to have it overwritten by an update. If this is updated please it will be greatly appreciated if you drop us a notification.

Thanks!

Hi Elize were you able to solve the zoom level problem?