0

I have map data for all of the towns in a state -- let's say California. I display every single town on a map using d3 -- everything is good so far. The projection I use makes use of the scale() and translate() functions, among others, to show my map how I want -- it looks nice.

Here is my problem. I need an automated way to expand my map projection so that it uses the entire svg area. In other words, I want to make my map bigger and bigger until either its width exactly equals the svg width or its height exactly equals the svg height.

I know the bounds function helps do this for an individual feature, but I want the entire state, not the individual town features, to fill the svg area.

Thank you for your help!

Joe
  • 1
  • 2
  • You could do the scale/translate processing ahead of time in topojson/ogr2ogr, then just use the default projection parameters. The map will stretch to take the full svg. – Union find Nov 08 '14 at 02:56
  • Mike Bostock's solution worked: http://stackoverflow.com/questions/14492284/center-a-map-in-d3-given-a-geojson-object – Joe Nov 21 '14 at 22:22

0 Answers0