I am trying to follow the excellent tutorial by Mike Bostock on medium with my own data.

Instead of a GeoJSON of California, I am trying to fit a small parcel somewhere in Norway to the map.

My input GeoJSON file is here, and looks like this:

GeoJSON file from parcel

Instead of using geproject to California Albers, I thought it would be better to use Transverse Mercator:

geoproject 'd3.geoTransverseMercator().fitSize([960, 960], d)' < se.json > se-transverse.json

The result of the project is [here]4, and it gave me the result I was hoping and expecting; all coordinates within the fitSize([960, 960] size. I am now wondering what I am missing to map this to scale. The resulting SVG I am getting after doing

geo2svg < se-transverse.json > se-transverse.svg


enter image description here

Which is just a tiny dot. It's the polygon, but not at scale. I thought the fitsize parameter fixed this, but there must be something else I am doing wrong.

1 Answer 1


This problem was due to me not knowing that the GeoJSON file needed to be in the reverse winding order.

My solution was to do install geojson-rewind and reverse the GeoJSON file.

npm install --save @mapbox/geojson-rewind

There is an option --counterclockwise in this tool that needed to be turned on, even though it makes the file clockwise (https://github.com/mapbox/geojson-rewind/issues/1#issuecomment-577174363)

Philippe Rivière at visionscarto.net was helping with this problem:


curl https://pastebin.com/raw/j5MN7AjA > ./original.geojson

follows GeoJSON spec

geojson-rewind original.geojson > ccw.geojson

this won't work: D3 expects clockwise polygons

geoproject 'd3.geoTransverseMercator().fitSize([960, 500], d)' < ccw.geojson > ccw-projected.json

geo2svg --fill red ccw-projected.json > ccw.svg


note that the --counterclockwise option creates clockwise polygons 🤣

geojson-rewind --counterclockwise original.geojson > cw.geojson

geoproject 'd3.geoTransverseMercator().fitSize([960, 500], d)' < cw.geojson > cw-projected.json

geo2svg --fill green cw-projected.json > cw.svg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.