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

Normalize geometry structure; classify polygon rings #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jfirebaugh
Copy link
Contributor

Fixes #32

No change in benchmarked performance.

@jfirebaugh
Copy link
Contributor Author

Downside of this change is that client code may need to switch on the geometry type in cases where it wants to handle all types of geometry in a uniform manner (e.g. do something to each vertex or ring). This is the case with mapbox-gl-native.

jfirebaugh added a commit to mapbox/vt2geojson that referenced this pull request Oct 9, 2015
@mourner
Copy link
Member

mourner commented Oct 10, 2015

Looks good to me. I was worried about performance degrade since all polygon features now go through ring classification (since there's no other way to determine if something is Polygon or MultiPolygon), but if benchmarks are fine, I'm 👍

@mourner
Copy link
Member

mourner commented Oct 12, 2015

@jfirebaugh @springmeyer should we also do a vector-tile-spec patch version bump that clarifies ring order in multipolygons?

@springmeyer
Copy link
Contributor

@mourner - yes, I had started this months ago but missed pushing: mapbox/vector-tile-spec#36

var area = signedArea(rings[i]);
if (area === 0) continue;

if (!ccw) ccw = area < 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tagging so that we don't forget: the condition should be ccw === undefined, otherwise classification is buggy in certain cases.

@springmeyer
Copy link
Contributor

springmeyer commented Apr 22, 2016

Next actions here now that we have the v2 spec in place (https://github.com/mapbox/vector-tile-spec/tree/master/2.1):

  • Add test/testcases with v2 tiles (These can be generated with tippecanoe or Mapbox Studio Classic)
  • merge and release, test in mapbox-gl-js
  • get on official tag: mapbox/vt2geojson@4724db1

@mourner
Copy link
Member

mourner commented Jul 19, 2016

Is this outdated now?

@jfirebaugh
Copy link
Contributor Author

No, not really. This is still a change that would make the vector-tile-js API a bit cleaner and remove the need for downstream clients to do ring classification, at the cost of a semver-major release.

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

Successfully merging this pull request may close these issues.

3 participants