geoproject

geoproject [options…] projection [file]

Projects the GeoJSON object in the specified input file using the specified projection, outputting a new GeoJSON object with projected coordinates. For example, to project standard WGS 84 input using d3.geoAlbersUsa:

geoproject 'd3.geoAlbersUsa()' us.json \
  > us-albers.json

For geometry that crosses the antimeridian or surrounds a pole, you will want to pass input through geostitch first:

geostitch world.json \
  | geoproject 'd3.geoMercator()' \
  > world-mercator.json

Typically, the input coordinates are spherical and the outut coordinates are planar, but the projection can also be an arbitrary geometric transformation. For example, to invert the y-axis of a standard spatial reference system such as California Albers (EPSG:3310) and fit it to a 960×500 viewport:

shp2json planar.shp \
  | geoproject 'd3.geoIdentity().reflectY(true).fitSize([960, 500], d)' \
  > planar.json

See also d3.geoProject and d3.geoIdentity.

doc_D3_Js
2016-11-24 10:26:34
Comments
Leave a Comment

Please login to continue.