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

Easier usage with d3.geoProject? #22

Open
mbostock opened this issue Oct 16, 2018 · 2 comments
Open

Easier usage with d3.geoProject? #22

mbostock opened this issue Oct 16, 2018 · 2 comments
Labels

Comments

@mbostock
Copy link
Member

It’d be nice if this library were easier to use when saving spherically-clipped GeoJSON. For example:

https://beta.observablehq.com/d/d706c7f9c6e46907

The tedious parts are:

  • You need to wrap the d3.geoClipPolygon instance with an object that has a stream method.

  • You need to compose the d3.geoClipPolygon instance with streams that transform from degrees to radians and then back again.

Part of me wonders if it’s worth revisiting a more composable geographic projection pipeline…

(Also, I think d3.geoProject sometimes breaks polygon semantics, but that’s a separate issue.)

@Fil
Copy link
Member

Fil commented Oct 28, 2018

Yes; it would be nice to have this also for clipAngle — in your notebook it works by using:

{
  const clipAngle = d3.geoClipCircle(50/180*Math.PI);
  return d3.geoProject(land, {stream: stream => radians(clipAngle(degrees(stream)))});
}

(So maybe an issue to solve in d3-geo-projection rather than d3-geo-polygon.)

We should also account for rotation.

Since your code is working, is it not just a question of defining a syntax?

The polygon issue is similar to d3/d3-geo-projection#146 (comment) : d3.geoProject is not meant to be used to project to spherical coordinates.

@mbostock
Copy link
Member Author

Yep, an issue of syntax and abstraction. I would love to revisit the composable geographic projection pipeline idea. I wonder if there is some progress to be made there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants