Git Product home page Git Product logo

Comments (6)

krisaoe avatar krisaoe commented on June 8, 2024 3

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.

krisaoe avatar krisaoe commented on June 8, 2024

Same issue here. Did you mangage to resolve this @stepankuzmin ?

from geojson-rewind.

stepankuzmin avatar stepankuzmin commented on June 8, 2024

Nope ¯_(ツ)_/¯

from geojson-rewind.

hoogw avatar hoogw commented on June 8, 2024

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.

hoogw avatar hoogw commented on June 8, 2024

@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.

mourner avatar mourner commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.