How to calculate the pixel width of entire world (at current zoom level)?

Discussion created by rexbradford on Nov 22, 2011
Latest reply on Nov 28, 2011 by rexbradford
I'm not even sure the title of this post is a valid concept.

But I am trying to track point overlays on a map, in pixel coordinates for fast manipulation, and things work fine until you wrap around the world horizontally.  Then the Graphic objects visually show up again, projected properly with wraparound, but the tracking code thinks they are way far to the left or right.

Specifically, map.toScreen(graphic.geometry) for points (Graphic objects in my case) in a wrapped view do not return the same x values as they would were the view not wrapped (by wrapped, I mean I panned the map using the UI).

I.e., if you pan the map eastward and wrap around, map.toScreen() will return negative numbers for the graphic objects which have "gone left off the screen but then have now returned from the right side".  At least it does this for me.

The offset which would fix this is presumably the pixel width of the entire world at the current zoom level.

Is it possible to calculate this value?

If it matters, this is spatial reference 102100 (WGS_1984_Web_Mercator_Auxiliary_Sphere).


Rex Bradford
Direct Relief International