I am trying to draw a map of New York using d3. I downloaded a bunch of shapefiles from http://www.nyc.gov/html/dcp/html/bytes/dwndistricts.shtml . I converted them to geoJSON using http://converter.mygeodata.eu/ so that they are in WGS 84 (otherwise, I think, latitude and longitude).
I'm sure geoJSON is valid: I can build it using matplotlib, and it looks like NYC, and the numbers seem to be in a valid range. Here is my javascript:
var path = d3.geo.path() d3.select("body") .append("svg") .attr("height", 1000) .attr("width", 1000) .append("g") .selectAll("path") .data(data.features) .enter() .append("path") .attr("d", path) .style("stroke","black") .style("stroke-width","1px")
These stories were announced to be Alberts New York projection. I think the problem is that the projection scale is chosen so that the United States approaches a beautiful web page, which makes NYC tracks a little distorted on the right side of the screen.
What is the “right” way (for example, to try to claim that d3onic first said) to scale a geo.path()
so that the extents of my lat / lon scale are the width and height of my SVG?
(few reservations: I apologize if I missed something obvious, this is for a project that I am trying to complete at the very end of the day)
source share