Skip to content Skip to sidebar Skip to footer

Plotting Lat/long On Map - D3.js V4

I have a simple map of the United States and I'm trying to plot some test Lat Long points. I found this block explaining the process but I'm having trouble converting the syntax to

Solution 1:

In that bl.ock you linked, you only need two changes to make it running with D3 v4:

  • var projection = d3.geo.mercator()var projection = d3.geoMercator()

  • var path = d3.geo.path()var path = d3.geoPath()

Here is the updated bl.ocks using D3 v4: http://bl.ocks.org/anonymous/d0b530924ef2aae3436840a1dbb3a39f

Regarding your fiddle, the issue is very simple: you are using an already projected JSON. Just set the projection to null:

.projection(null)

Here is the updated fiddle: https://jsfiddle.net/vypu9qwr/

Post a Comment for "Plotting Lat/long On Map - D3.js V4"