Comments (6)
No matter what I tried with this package, identical geojson is returned.
@stepankuzmin I ended up using @turf/rewind, works like a charm.
from geojson-rewind.
Same issue here. Did you mangage to resolve this @stepankuzmin ?
from geojson-rewind.
Nope ¯_(ツ)_/¯
from geojson-rewind.
No matter what I tried with this package, identical geojson is returned.
@stepankuzmin I ended up using @turf/rewind, works like a charm.
Same here, no matter what polygon I input, use false, or true, the result always is same as orginal input, rewind did not work.
from geojson-rewind.
@turf/rewind, works like a charm, but not solve my problem.
// https://macwright.org/2016/09/26/the-180th-meridian.html
// geojson must follow right hand rule, means must counter-clock-wise,
// if user zoom to the whole world, or alaska area, bounding box will cross the 180th meridian, will get error validate with geojsonlint ( not counter clock wise error)
// so must re-winding the geojson points, normally, it is 01234(sw, se, ne, nw), re-winding means, 03214( swtich 3 and 1)
// this will create another polgyon cross the other side of earth( asia), not the one we need cross 180th meridian. (rewind is not the solution)
// rewind, not use, but tried
// NOT works, https://github.com/mapbox/geojson-rewind, no matter what polygon I input, alway output the same, no rewind
// works @turf/rewind https://github.com/Turfjs/turf/tree/master/packages/turf-rewind
// var original_polygon = turf.polygon(current_bounding_box.coordinates);
// var rewind_polygon = turf.rewind(original_polygon, { reverse:false, mutate: false }); // default reverse:false, mutate:false
// 2 way:
// one way, create 2 polygon, split by 180 meridian ( geojson recommended, but may be hard for software to implement)
// second way, 360-(+178) = -(182), use number outside range -180 to +180. ( easy for software implement )
// how to identify if geojson cross 180 meridian? geojonhint()
var geojsonhint_error = geojsonhint.hint(current_bounding_box, {noDuplicateMembers: false })
from geojson-rewind.
In this case the problem is caused by a few polygons in the test example that look like this:
[
[7.396768398983337, 43.72260793482001],
[7.396784857564814, 43.722607191112004],
[7.396784857564812, 43.722607191112004],
[7.396768398983337, 43.72260793482001]
]
Due to floating point error, calculating an area of a near-zero area polygon produces 0, even if you reverse the order of the point. I can fix this on geojson-rewind
side with a more precise summation algorithm, but to update the tests, we would need a fix on geojsonhint
side as well because it has the same issue.
from geojson-rewind.
Related Issues (15)
- Swap counterclockwise for clockwise default HOT 3
- missing dependency: sharkdown HOT 3
- Does not rewind GeometryCollections HOT 4
- Chokes on GeoJSON files as UTF with BOM HOT 1
- concat-stream, minimist and sharkdown should be dev dependencies HOT 1
- Crashes on Geometries with empty coordinates
- Using sharkdown which uses minimist with a CVE HOT 3
- Introduce bundler or export an es module
- Possible error in rewindRing error calculation HOT 2
- Fix critical security issue in the minimist dependency
- Typing
- https://bundle.run/geojson-rewind linked in readme is 404ing
- isRightHandRule function HOT 2
- geojson-area deprecation warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geojson-rewind.