Map Extent bug with wrapAround180

1304
4
07-25-2011 08:49 AM
TonyMonsour
New Contributor
I have a couple functions which call for the Map Extent.  I am also utilizing the wrapAround180.  I notice that if I continuously pan to the East (or West) the map extent grows and no longer is giving me the true Map Extent values. 

I can understand why this is happening but I would still consider it a bug since map.extent should give me real world values.  I am not sure if this is causing errors for other functions that get map coordinate values as well. 

My questions are:
Is there another way to call for the map extent in this case?
Is anyone aware if this is causing errors for other values?
Is the JavaScript team aware of this?


Thanks,
Tony
0 Kudos
4 Replies
JianHuang
Occasional Contributor III
Tony,

Sorry about the confusion. This is by design to accommodate wrap-around functions. You can normalize the extent to get the real extent in the origin world. Please try the code as:
    if (map.spatialReference._isWrappable()) {
      xmin = esri.geometry.Extent.prototype._normalizeX(map.xmin, map.spatialReference._getInfo()).x;
      xmax = esri.geometry.Extent.prototype._normalizeX(map.xmax, map.spatialReference._getInfo()).x;
      var realExtent = new esri.geometry.Extent(xmin, map.ymin, xmax, map.ymax, map.spatialReference);
    }
0 Kudos
TonyMonsour
New Contributor
a couple tweaks and it works great. Thanks

xmin = esri.geometry.Extent.prototype._normalizeX(map.extent.xmin, map.spatialReference._getInfo()).x;
     xmax = esri.geometry.Extent.prototype._normalizeX(map.extent.xmax, map.spatialReference._getInfo()).x;
     var realExtent = new esri.geometry.Extent(xmin, map.extent.ymin, xmax, map.extent.ymax, map.spatialReference);
0 Kudos
mikewebster
New Contributor II
would this technique resolve the following 2 reported bugs?

Bug NIM066689: After setting WrapAround180, when panning across the dateline, the 'extent' geometry does not wrap like a polygon geometry does.

Bug NIM066454: The wrapAround180 causes screen coordinates to get out of sync which breaks geometry capabilities.

</webskister>
0 Kudos
TomAuer
New Contributor
Is there a similar workaround to this problem for the Flex API?

I get a garbage map extent after panning left through the IDL with wraparound.
0 Kudos