Select to view content in your preferred language

Polygons crossing the 180 meridian

9821
5
01-28-2013 05:27 AM
TraceyRichvalsky
Emerging Contributor
I am trying to display a set of polygons (rectangles) that cross the 180 meridian.  However instead of showing up as crossing the 180 meridian, they all show up as a very wide rectangle that goes the "other way" around the map.  It's as if east and west are reversed when the polygons cross the dateline.  Is this a known issue?  I currently have v2.4 of the API.  Is this fixed in a later version if it is an issue in 2.4?
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor
How is created your polygon?

If all X coordinates of your polygon are between -180 and 180, your polygon will not cross the date line (except if your polygon has been normalized and contains multi rings).
0 Kudos
TraceyRichvalsky
Emerging Contributor
Say I make a polygon from the following points:
NE point: Lat 45, Lon -178 (east of the meridian)
SE point: Lat 40, Lon -178
SW point: Lat 40, Lon 176 (west of the meridian)j
NW point: Lat 45, Lon 176
NE point: Lat 45, Lon -178 (to join to the original point and complete the polygon)

It should cross the meridian, but instead it goes the other way around the globe.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
To cross the meridian, you need either to use X coordinates < -180 or > 180, or you need to create 2 rings for your geometry.

In your case:
NE point: Lat 45, Lon 182 (east of the meridian)
SE point: Lat 40, Lon 182
SW point: Lat 40, Lon 176 (west of the meridian)j
NW point: Lat 45, Lon 176
NE point: Lat 45, Lon 182 (to join to the original point and complete the polygon)

Then you can normalize that geometry and you'll get 2 rings.
0 Kudos
TraceyRichvalsky
Emerging Contributor
Thank you - that helps a great deal! 

Could you please explain your last statement though?  "Then you can normalize that geometry and you'll get 2 rings."  I'm not sure how to do that or what effect it would have.  Thanks!
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The NormalizeCentralMeridian method transforms a geometry to stay within the -180/+180 extent.
In case of a polyline or polygon crossing the dateline, the result is a polyline with 2 paths (and respectively a polygon with 2 rings), one close to -180 and the other close to +180 longitude.

You can look at the ShowMapExtent sample which uses the method NormalizeCentralMeridian.

Most generally you don't need to normalize a geometry for working at client side. More useful for the storage at server side.
0 Kudos