simplegeo / polymaps

Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.
http://polymaps.org/
Other
1.6k stars 213 forks source link

Lines crossing the antimeridian are not rendered correctly. #33

Open mbostock opened 14 years ago

mbostock commented 14 years ago

When we encounter such geometry, presumably we should project so as to minimize the distance between adjacent points.

Interestingly this bug was also in Google Earth:

http://code.google.com/p/kml-samples/issues/detail?id=227

arktisma commented 12 years ago

Is this bug still active? Because I have attempted to run a line from Pitcairn Island to Opua, New Zealand, and am encountering this bug, whereby the line is rendered in reverse to its destination (NZ).

This seems like a fairly significant bug... Are there any workarounds? I am attempting to plot a round the world route. Here is a screen cap: http://cl.ly/1e2R1J2d3M1b193L011i

arktisma commented 12 years ago

Additionally, if I attempt to stop my linestring 0.0 and start it again at 180, I encounter a secondary issue: http://cl.ly/0N383q1I2w2e3M3P2X2c

mbostock commented 12 years ago

If you use longitude values greater than +180 or less than -180, you can force Polymaps to pick one side of the Earth, rather than bouncing between the two.

arktisma commented 12 years ago

Ok, I'm a bit confused. This is my JSON...

[ { "source": [ -122.51541137695312, 37.80761398306056 ], "target": [ -72.70751953125, -55.54106495611102] }, { "source": [ -72.70751953125, -55.54106495611102 ], "target": [ -67.269287109375, -56.016807763203204] }, { "source": [ -67.269287109375, -56.016807763203204 ], "target": [ -109.3664237, -27.1211919 ] }, { "source": [ -109.3664237, -27.1211919 ], "target": [ -127.439308, -24.703615 ] }, { "source": [ -127.439308, -24.703615 ], "target": [ -0.0, -143.94241333007812 ] }, { "source": [ 180,-35.3130147 ], "target": [ 144.9629796 , -37.8131869 ] } ]

The last line of the above JSON, is the linestring that is being pushed onto the wrong side of the map.