-
Notifications
You must be signed in to change notification settings - Fork 944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toMercator changes polygons geometry #1602
Comments
@Darune you are right, also the I think it would be useful also to add a set of tests like what you posted, where the double conversion should coincide with the original feature; something like: t.deepEqual(feature, toWgs84(toMercator(feature))); |
Great, I didn't have time to handle this today, i'll do this on monday |
Any specific reason to use proj4js for validation ? |
@Darune I have no idea what you're talking about... 😅 |
The tests for Clearly use proj4 to validate the function output. |
I have never used As long as it works I don't think what tool you use for validation matters. However I'm not the best person to give advice on this. |
I am not familiar with the |
Yeah unfortunately the tests and the code are currently setup to run against individual coordinates rather than seeing them in context of a geometry that is crossing the anti-median, so a bit of thought needs to happen to get things behaving and tested properly. |
I could retry writing tests for this, it has been stalled for way too long, but I might have time next week to digg this out of the dirt |
When using toMercator on a polygon that overlap the -180 or 180 longitude, without antimeridian cutting.
The current implementation wraps every point one by one which ends up returning a wrong polygon:
Here is a polygon overlapping the -180 longitude:
Here is the result of a
toMercator
transformation reconverted usingtoWgs84
:code to reproduce the issue:
I think that when calling
toMercator
with a GeoJson, turf should not try to wrap longitude as it does.if this is an acceptable behavior I could submit a PR
The text was updated successfully, but these errors were encountered: