Skip to content
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

Missing polygons #580

Closed
Plantain opened this issue Jun 1, 2018 · 6 comments
Closed

Missing polygons #580

Plantain opened this issue Jun 1, 2018 · 6 comments

Comments

@Plantain
Copy link
Contributor

Plantain commented Jun 1, 2018

Hi,
I have a GeoJSON file that renders on tools such as Mapshaper.org as follows:
screen shot 2018-06-01 at 3 35 23 pm
Run through tippecanoe, half the content seems to be lost, as shown by mbview.
screen shot 2018-06-01 at 3 36 09 pm
Same behaviour with -zg or with manually specified levels.

Attached mbtiles file, and GeoJSON data.
mbtiles+json.zip

@e-n-f
Copy link
Contributor

e-n-f commented Jun 1, 2018

Thanks. I'll download it and take a look.

@e-n-f
Copy link
Contributor

e-n-f commented Jun 1, 2018

What you get by directly uploading the GeoJSON to Mapbox looks a lot like the Tippecanoe output, so Tippecanoe and Mapnik must be interpreting it similarly.

screen shot 2018-06-01 at 10 30 42 am

Still trying to figure out what Mapshaper is doing differently.

@e-n-f
Copy link
Contributor

e-n-f commented Jun 1, 2018

The discrepancy is introduced by the use of Wagyu to clean the polygon geometry. With polygon cleaning turned off, the geometries are strange, but there are a lot more of them.

screen shot 2018-06-01 at 10 47 11 am

@e-n-f
Copy link
Contributor

e-n-f commented Jun 1, 2018

The fundamental problem is that many of the outer polygon rings are marked in the GeoJSON as being interior rings.

   o  For Polygons with more than one of these rings, the first MUST be
      the exterior ring, and any others MUST be interior rings.  The
      exterior ring bounds the surface, and the interior rings (if
      present) bound holes within the surface.

Ignoring the GeoJSON spec and detecting inner/outer rings by winding rather than by ring order within the geometry gives the intended result:

screen shot 2018-06-01 at 12 18 07 pm

So the big question is: should I treat this as an error in the source data, or should I add --use-original-winding and --reverse-original-winding flags to detect inner and outer rings by winding rather than by ring order?

@Plantain
Copy link
Contributor Author

Plantain commented Jun 1, 2018

I have seen this behaviour from files generated with a number of different tools, so I think there might be some merit in adding the flags you mention. This particular file was generated by geojsoncontour, I will open an issue and investigate with them too.

@e-n-f
Copy link
Contributor

e-n-f commented Jun 1, 2018

#581 adds the --use-source-polygon-winding and --reverse-source-polygon-winding flags.

@e-n-f e-n-f closed this as completed Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants