question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map is broken / filled in, despite using valid GeoJSON

See original GitHub issue

I’m creating a map in the style of the example at https://www.react-simple-maps.io/docs/geographies/. The only difference is that instead of a link to a TopoJSON file, I am using an array of GeoJSON MultiPolygons. The exact object I’m passing to Geographies can be found in this gist. If you want to see what it looks like, here it is formatted as a FeatureCollection. It’s valid, because GitHub manages to display it fine.

What I get looks like this:

Screenshot from 2020-06-05 23-41-06

The stroke I’m using is red, and the fill is black.

What I expect to happen is something like the GitHub display linked above, but this isn’t what happens. Any help is appreciated!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jthistlecommented, Jun 8, 2020

Don’t worry, managed to fix it! My pipeline ended up looking like:

  • start with ONS-provided GeoJSON
  • rewind the bounds with @mapbox/geojson-rewind (setting clockwise to true - important)
  • convert to topojson with topojson-server
  • simplify with topojson-simplify (which expects smaller values for the weight threshold than I expected!)
  • reformat for database storage

Thanks again for all your help! 😃

uk_good

1reaction
jthistlecommented, Jun 6, 2020

Ah, that helps a lot, thank you! I think I’m going to end up converting GeoJSON to TopoJSON server-side and sending that over, then using it for the map, since that’ll help loading times as well as making it work. Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Choropleth map not working with my geojson data
Any idea why my choropleth plot is not working out? It just shows one of the 11 areas and colors the rest of...
Read more >
geojson fill broken · Issue #8161 · mapbox/mapbox-gl-js · GitHub
Your GeoJSON is not valid — in the first feature, an inner ring (hole) is outside of the outer polygon. We can't technically...
Read more >
D3 V6 and JavaScript - GeoJSON fill is "spilling" outside of path
Closed 2 years ago. Creating a map using D3 V6, showing educational attainment by county. I have a counties.topojson and csvData.csv which are ......
Read more >
Chapter 7 GeoJSON | Introduction to Web Mapping
This chapter is devoted to more in-depth treatment of the format and its use in web maps. GeoJSON has become a very popular...
Read more >
GeoJSON Hosted Layer Error - Esri Community
I'm attempting to publish a geojson file as a hosted layer to ArcGIS Online but it gives me "There was an error".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found