AnsweredAssumed Answered

Create polyline which crosses international date line

Question asked by tomrip on Feb 20, 2015
Latest reply on Feb 26, 2015 by tomrip

Hello.

 

I am working with the 3.12 version of the JavaScript API, and my map is using WMAS as the spatial reference.

 

When i use the Draw toolbar to create a polyline from San Francisco to Sydney, AU, the line is drawn such that it crosses the international date line.  However, when i programmatically create a polyline that uses coordinates created by converting Lat.Lon to WMAS with the web mercator utilities, the line does not cross the international time. Instead, it goes off in an Eastward direction to get to Sydney.  No matter how many points i put between San Francisco and Sydney, the line always approaches the international date line, then heads eastward all the way around the globe to Sydney.

 

When i compare the 'paths' of the line created by the Draw toolbar and the polyline i created by programmtically adding points, i see that locations like Sydney have different values for X and Y. Two different coordinate sets represent the same place on Earth, even though both coordinate pairs are using the same Spatial Reference

 

My question is, I suppose, how do i convert values generated by the web mercator utilities into values that will cross the international date line? In other words, how can i get the same values as those created by the draw toolbar?

 

Thank you.

 

Coords for approximately Sydney when the point is created by the Draw Toolbar

[ -23223191, -4049281]

 

Coords for approximately Sydney when the point is created by converting from Lat/Lon using the web mercator utilities

[16832553, -4010018]

 

Both pairs have spatial reference:

{ "wkid": 102100, "latestWkid": 3857}

Outcomes