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

geoscale #77

Closed
mbostock opened this issue Oct 31, 2016 · 2 comments
Closed

geoscale #77

mbostock opened this issue Oct 31, 2016 · 2 comments
Assignees

Comments

@mbostock
Copy link
Member

It’d be nice to have a binary for taking projected, planar GeoJSON as input and then transforming the coordinates to fit the specified bounding box. It should also support --invert for flipping the y-dimension, as Proj4 and other projection systems typically use the other y direction than Canvas and SVG.

https://github.com/topojson/topojson/blob/v1.6.27/lib/topojson/scale.js

@mbostock
Copy link
Member Author

mbostock commented Nov 1, 2016

I don’t think this needs to be a separate binary, since geoproject lets you specify the projection expression, meaning you can use d3.geoTransform to flip, and d3.geoIdentity to scale-to-fit.

https://bl.ocks.org/mbostock/5663666

@mbostock
Copy link
Member Author

mbostock commented Nov 1, 2016

Yep…

shp2json nad83.shp | \
  geoproject 'd3.geoTransform({point: function(x, y) { this.stream.point(x, -y); }})' | \
  geoproject 'd3.geoIdentity().fitSize([960, 500], d)' | \
  geo2svg > test.svg

It’d be nice to have d3.geoInvertY() as shorthand for the first, though.

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

No branches or pull requests

1 participant