Select to view content in your preferred language

Map Lockup After Zoom

2515
11
Jump to solution
07-13-2012 10:06 AM
MatthewLawton
Deactivated User
I have a highly customized JS API app that I created a couple years ago and have upgraded along the way and is currently running on version 2.8. I have recently found a very annoying bug. I'm not sure when this bug popped up, but I don't think it was always there. I noticed that when I perform a query, which includes a zoom to extent once the target feature is found, my map locks up. More specifically, the coordinate readout on my map will not update and any overlaying map services will not update, they just remain pixelated on top of my basemap. If I attempt to click on the map to do an identify then the identify hangs the first time, however if I click the map a second time then the identify is successful. If I pan the map then the coordinate readout refreshes and the overlaying map services draw correctly. So this bug only occurs immediately after a query is performed. If I run a query and the map only pans to a new target location without zooming then everything is fine. The lock only seems to occur if there is a zoom action performed when the setExtent function is called.

I am guessing that I must have some sort of listening action that is performed when zooming that is perhaps interfering with the query action which doesn't allow the map refresh to complete successfully. This is likely causing the coordinate extent to not update to the new map extent, therefore the coordinate readout lockups, and apparently it disables the map click listener so that the identify task will not execute properly.

The problem is that I cannot find anywhere in my code what the possible cause might be. I figured I would throw this out to the forum first to find out if this is a known bug or if anyone has encountered a similar problem. Sorry if this description is vague but I figured I would provide a high level explanation before diving into the details of the code. If anyone can provide some meaningful feedback then I would be much appreciative.
0 Kudos
11 Replies
StephenLead
Honored Contributor
It was the extent. Apparently the spatial reference needed to be set in the identify parameters. Everything worked once I added this line of code:

        identifyParams.spatialReference = new esri.SpatialReference({ wkid: 102100});




Glad you got it sorted - sorry I wasn't able to help with this one.

It might be an idea to have a global variable for the projection, to avoid errors like this? Or perhaps you could load the identify's projection from the map's projection?

Cheers,
Steve
0 Kudos
VinayBansal
Frequent Contributor
Thanks man, your post  really saved my time.... Extent must have the spatial reference defined.

Holy Cow!!!

It was the extent. Apparently the spatial reference needed to be set in the identify parameters. Everything worked once I added this line of code:

  identifyParams.spatialReference = new esri.SpatialReference({ wkid: 102100});


Man, that was frustrating. Jeff, your response focused me on the extent and spatial reference. Have some points. Enjoy!
0 Kudos