holocron

Map will not automatically pan and zoom to location when using dynamic map services.

Discussion created by holocron on Aug 10, 2012
Latest reply on Aug 10, 2012 by holocron
I have a mobile app that only displays simple features from a dynamic map service.  I have a button on the map that calls the geolocation functionality that will place a marker on the map of the users current location and then automatically pan to that location by using map.centerAndZoom(pt, 4).  But I discovered that if the dynamic service is the only service in the app, the map will not pan to the location (the marker is placed in the right location though, so geolocation is working).  But if I place a tiled map service before the dynamic service in my code, then the geolocation works properly and will pan to the location.  As a workaround, I have set a tiled service in my code first and just set the opacity of it to 0 so that it doesn't display.  This same behavior occurs with geocoding an address on the map.  For this my code also uses centerAndZoom to go to the address location on the map.  Again, if the dynamic service is first in the code then centerAndZoom doesn't work.  Is this expected behavior for centerAndZoom against dynamic map services?

Outcomes