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

Foreground 3D extrusions missing in output tiles #4

Open
CloudNiner opened this issue Apr 23, 2019 · 4 comments
Open

Foreground 3D extrusions missing in output tiles #4

CloudNiner opened this issue Apr 23, 2019 · 4 comments

Comments

@CloudNiner
Copy link
Contributor

CloudNiner commented Apr 23, 2019

Issue is the same as experienced in mapbox/mapbox-gl-js#7767:

Screen Shot 2019-04-23 at 2 00 07 PM

We aren't generating tiles with PostGIS so we're likely experiencing a similar issue somewhere in the JTS + GeoTrellis + GenerateVT. The linked issue notes that:

Uncaught Error: Vector Tile has POLYGON with first ring clockwise. It is not valid according to v2 of VT spec.

Might be a good first place to look, and ensure that our tiles are exporting geometries that are correctly wound clockwise.

We'd require further testing to determine if this issue is present in the new VectorPipe RC2+ releases.

@jpolchlo
Copy link

jpolchlo commented Apr 23, 2019

JTS has no winding requirement. If you need to reverse a ring, there is a way to extract the coordinate sequence from a polygon (and, I presume, its holes) and reverse it and build a new poly from the result. This gets to be non-trivial, though, if there are "islands" inside holes (i.e., a polygon with a hole with another positive area inside the negative space). You'll have to build the hierarchy of rings yourself and then check them for winding manually (assuming valid geometry, this should just be a bunch of contains checks). An easy winding test is described here.

@CloudNiner
Copy link
Contributor Author

Oof, that certainly seems like the cause. The MapBox Vector Tile spec states:

Any polygon interior ring must be oriented with the winding order opposite that of their parent exterior ring and all interior rings must directly follow the exterior ring to which they belong. Exterior rings must be oriented clockwise and interior rings must be oriented counter-clockwise (when viewed in screen coordinates).

Thinking about this more generally, and we can move the conversation, does an option to re-wind ring geometries make sense as something that the new VectorPipe API provides? Otherwise it appears that any attempt to use extrusion will render poorly.

@jpolchlo
Copy link

It makes sense. I've always wondered why JTS isn't picky about winding order, since it's very common throughout computer graphics that polygons have CCW winding. (Come to think of it, it's weird that the VT spec wants a CW exterior winding...)

At any rate, this is a thing VP should provide. Go ahead and create an issue for it? Include that quote from the spec, if you would.

@CloudNiner
Copy link
Contributor Author

👍

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