Skip to content

projection.clip: sphere, frame, angle #1150

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

Closed
wants to merge 5 commits into from
Closed

projection.clip: sphere, frame, angle #1150

wants to merge 5 commits into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Dec 5, 2022

Introduces two projection options:

projection.clipAngle

a number, passed directly to the projection factory. This also forces fitting the projection to the frame with its restricted sphere path.

projection.clip

same keywords as the mark’s clip option (frame, sphere and null), but interpreted with a different technique. This option applies to all the paths generated by the geo marks (geo, graticule, and sphere). [EDIT: it's more complicated than that]

It defaults to "frame", which uses the clipRectangle post-clip stream; this approach two benefits:

  1. the user doesn’t have to add an explicit clip:"frame" option to the geo marks to avoid bleeding in the margins and between facets
  2. the computed paths do not extend (invisibly) as much, which seems to make the SVG lighter, and in particular consume less memory when a map zoomed to a large scale has a "heavy" geo mark than spans the whole globe

The second option is "sphere", which can be used to add a clip-path to all the geo marks of the plot (an exception is made for the sphere mark itself).

Use null to disable.

Since this changes almost all the test maps, I'm taking this as an opportunity to switch most of them from 50m to 110m geometries, in order to make the tests a bit faster, and the repo a bit smaller.

closes #1137
closes #1131
supersedes #1132

@Fil Fil added enhancement New feature or request geo Maps and projections labels Dec 5, 2022
@Fil Fil requested a review from mbostock December 5, 2022 01:34
@Fil Fil marked this pull request as draft December 5, 2022 07:33
@Fil
Copy link
Contributor Author

Fil commented Dec 5, 2022

This is trying to do too much. I'll prepare an alternative minimalist version.

Fil added 5 commits December 5, 2022 08:44
Defaults to "frame", which uses the clipRectangle post-clip stream; this has two benefits:
1. the user doesn’t have to add an explicit clip:"frame" option to the geo marks to avoid bleeding in the margins and between facets
2. the computed paths do not extend (invisibly) as much, which seems to make the SVG lighter, and in particular consume less memory when a map zoomed to a large scale has a "heavy" geo mark than spans the whole globe

The second option is "sphere", which can be used to add a clip-path to all the geo marks of the plot (except, of course, the sphere mark itself.

Use null to disable.

Since this changes almost all the test maps, I'm taking this as an opportunity to switch most of them from 50m to 110m geometries, in order to make the tests a bit faster, and the repo a bit smaller.
@Fil Fil force-pushed the fil/clip-projection branch from 19752bc to 8aec502 Compare December 5, 2022 08:11
@Fil Fil mentioned this pull request Dec 5, 2022
@Fil Fil closed this Dec 5, 2022
@Fil Fil mentioned this pull request Dec 5, 2022
@Fil
Copy link
Contributor Author

Fil commented Dec 5, 2022

superseded by #1151

@Fil Fil deleted the fil/clip-projection branch December 5, 2022 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request geo Maps and projections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support clip-to-frame (clipRectangle) and clipAngle projection options Plot.geo should default to clip: "frame"?
1 participant