0

I am trying to modify this example with data from cvs file with node and link data. I have addresses that were obtained from python's googlemaps module. All the nodes have, two floats 39.338923 / -74.475714 that represent the longitudinal/ latitudinal (lng/lat) coordinates. However, when I get to:

.attr("d", function(d) { return path({type: "LineString", coordinates: [d.source, d.target]}); });

in the said example, things get fishy. Displaying the output of path() via console.log, I see NaN and LNaN. I have looked at this SO question, and I am fairly certain all lng/lat values are "kosher".

Since I am very new to javascript, d3.json, and cartography, how should I go about trouble-shooting this problem? I currently stuck. Since path()'s output is a string, I could find the lng., lat. values that give the NaN. Here are some examples:

`-77.3860976/38.9695545 ----->M757.197171551755,218.52497030237407LNaN,NaN`
`-77.3860976/38.9695545 ----->M757.197171551755,218.52497030237407LNaN,NaN`

There is a lot of link data that is not able to be used due to the problem. I know there are lot of places the code could have gone wrong prior to this. I will say that if I comment out the above .attr("d",..., there are no errors. Unfortunately, the links are not drawn in this case. Any and all help is hugely appreciated!

Community
  • 1
  • 1
Charlie
  • 189
  • 14
  • Have you check to see if your lat/long are the wrong way round. The way you've stated 39.338923 / -74.475714 as longitudinal/ latitudinal coordinates seems the wrong way around to me. – user1614080 Jan 29 '15 at 10:24
  • Fairly certain, they are correct because the nodes are drawn correctly. Also, when I switch the order, no nodes show up at all. I will put the example I have on a server later today and share the link. – Charlie Jan 29 '15 at 19:10

0 Answers0