mapbox / geojson.io

A quick, simple tool for creating, viewing, and sharing spatial data
http://geojson.io/
ISC License
1.91k stars 566 forks source link

Possible to generate longitude coordinates > 180 #606

Open batpad opened 6 years ago

batpad commented 6 years ago

Steps to reproduce:

Pan the map right to the "second" world by panning right past the international date line. Then add a point. The longitudinal value for the point gets set as 360 + the real longitude value. This has an additional side effect of breaking the geocoder since the geocoder sends the proximity parameter with a lon value above 180.

Expected behaviour:

It should never be possible to generate longitude values < 180 or > 180.

Possible solution (?):

Restrict the bounding box of the map to -180,180 or so?

Not sure what the best solution here is, or if there is a legitimate use-case for coordinates > 180 - if this seems like a bug, happy to make a PR.

bhousel commented 6 years ago

I agree @batpad - RFC7946 suggests that tools creating geojson should implement antimeridian cutting.

I guess we'd want a twofold solution:

tmcw commented 6 years ago

Might I recommend implementing this feature as an explicit option in the Meta category rather than a default behavior:

bhousel commented 6 years ago

Thanks @tmcw .. I agree with your points above.

geojson.io support for multilinestrings is bad, and improving it is a very large and separate task that would have to be implemented before this one in order for antimeridian cutting to not be a hassle

Can you say more on this? Sorry if there are known issues - still getting up to speed on the issue tracker.

My thought was to use one of the more lightweight turf.js functions to do the clipping (bboxClip?) if the user chooses that option.

tmcw commented 6 years ago

See the upstream issues in Leaflet.draw - geojson.io cannot edit Multilinestring/Multipolygon because of said issues.