LocalMapService not updating layout on map PanTo call

637
3
Jump to solution
12-10-2012 05:32 AM
Labels (1)
AaronBotnick
New Contributor II
I have an interesting problem.  I am using a LocalMapService object with ArcGISDynamicMapServiceLayer to display a large streets shapefile, large enough that a LocalFeatureService is not a viable option.  This map uses GPS data, obtained through a service and not the hardware directly, to track the users location, and keeps the map centered on that moving point.  The update frequency is such that calling the PanTo function with the default animation duration set causes a strange oscillation with the map center to locations that have not been called for.  As such, I set the pan duration to 0s which seems to correct that issue.  However, what I then find is that the map does not update its layout when the PanTo completes.  This may be related to the fact that there are upwards of 3 calls per second, but I'd still expect the new map tiles to be rendered from the dynamic layer.

The only way I seem to be able to get an update to happen is to stop the auto-centering, and pan the map with the mouse only.  This same behavior is repeatable by only calling PanTo once.  I've tried invalidating the display and calling UpdateLayout immediately after the PanTo command, but this does not cause an update to occur.

Any suggestions?  The auto-tracking behavior and use of a LocalMapService is a current requirement dictated by the size of our dataset to display.

As an additional question...  I see that it is possible to set the background color for the map; however, when using a LocalMapService, it appears that it renders tiles assuming a white background.  This makes lines and text labels look very poor when using a black background for a night-mode.

Thanks for any help or suggestions on this.
0 Kudos
1 Solution

Accepted Solutions
AaronBotnick
New Contributor II
I figured out a workaround for my problem.  When a pan event comes through, I "queue" further pan events until the ExtentChanged event fires and then pan to the saved location.  This effectively filters pans so that they don't interfere with one another.  This wouldn't even be an issue if PanTo worked correctly in rapid succession when animation is turned off using PanDuration.  Under those circumstances, the LocalMapService layer doesn't redraw.

View solution in original post

0 Kudos
3 Replies
AaronBotnick
New Contributor II
This seems to be related to the number of updates that are coming in from the GPS service.  On each update received, there is a call to PanTo.  I'm assuming that each successive call results in a cancellation of the previous request.  The problem is that I never seem to get an updated view, as every update request to the map service will be cancelled by the next call.  The more weird part is that if I turn off the location tracking (constant use of PanTo to center the map), the final PanTo command never results in a refresh/update/redraw of the map data until I move the map with the mouse.
0 Kudos
AaronBotnick
New Contributor II
I figured out a workaround for my problem.  When a pan event comes through, I "queue" further pan events until the ExtentChanged event fires and then pan to the saved location.  This effectively filters pans so that they don't interfere with one another.  This wouldn't even be an issue if PanTo worked correctly in rapid succession when animation is turned off using PanDuration.  Under those circumstances, the LocalMapService layer doesn't redraw.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Many thanks for the update - we'll investigate whether this is something that need to be addressed in the API.

Cheers

Mike
0 Kudos