GithubHelp home page GithubHelp logo

Comments (9)

Fil avatar Fil commented on April 28, 2024 1

It should work. Please make sure the polygon has the expected winding order. https://observablehq.com/@fil/rewind
I'm going to close the issue, but if you think this is a bug, please share the data which triggers it, and I'll reopen.

from d3-geo.

Fil avatar Fil commented on April 28, 2024 1

If you rewind it it works
https://observablehq.com/@recifs/dublin-geojson--support

from d3-geo.

Fil avatar Fil commented on April 28, 2024 1

Consider fixing the geojson outside your application. If that's not possible, then you should copy 3 cells: geoRewindFeature and its dependencies geoRewindStream and geoProjectSimple. Also make sure you agree with the license (which I had not set yet, now ISC).

from d3-geo.

secondl1ght avatar secondl1ght commented on April 28, 2024

Thanks for the quick response @Fil, I have tested to make sure the polygon is in the expected winding order by using this GeoJSON linter at https://geojsonlint.com/. It will notify you if you need to rewind the data and also the polygon is displaying correctly on my map and I am not seeing this behavior you described:

Alas when it happens, it’s painful: a shape that represents a tiny speck of land becomes inflated to represent the whole globe minus that tiny speck of land, the map fills with a uniform color, the local projection explodes.

Here is an example of one of the GeoJSON files that does not seem to be working correctly for me: https://gist.github.com/secondl1ght/a902b36dac2379fead3452af49a77973

The same code I wrote is working for other polygons so your theory does make sense that it would be certain GeoJSONs that I am using causing issues. I thought I had it narrowed down to a multipoly issue because those seemed to be the problem ones from when I looked. Maybe you can see if something is wrong with this Dublin file I shared?

Thanks for the help!

from d3-geo.

secondl1ght avatar secondl1ght commented on April 28, 2024

Wow ok thanks! I guess I should have tested that the polygon drew correctly using D3. I am trying to find your package to use but I don't see it on NPM when I search for @fil/rewind, do you mind sharing a link to it please?

from d3-geo.

Fil avatar Fil commented on April 28, 2024

For now it's just a function in a notebook. https://observablehq.com/@fil/rewind

More discussion at #138

from d3-geo.

secondl1ght avatar secondl1ght commented on April 28, 2024

Thanks, I had a look and it's not super clear to me which part of the code I need to copy over into my app. There is a lot of code there, do I need all of it to complete the rewind that I require?

from d3-geo.

secondl1ght avatar secondl1ght commented on April 28, 2024

Thanks, is there also a way to check which polygons need to be rewound? I don't want to rewind ones that are already following the required spec.

from d3-geo.

secondl1ght avatar secondl1ght commented on April 28, 2024

I tried fixing the geojsons outside the application using https://geojsonlint.com/ to check for the 'right-hand rule'. But for some reason the problem GeoJSONs are not being picked up with errors on the lint website but they are still not working with D3.

from d3-geo.

Related Issues (20)

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.