0

I'm trying to create a map based D3 visualisation but my limitation is that my data is a tabular, csv format data. I have two options - 1. Convert the csv to a geoJSON format in javascript itself 2. Work with the csv data and figure out how to get the D3 functions to work with it.

I'm trying to modify this example - http://zevross.com/blog/2014/09/30/use-the-amazing-d3-library-to-animate-a-path-on-a-leaflet-map/ to work with my data which has two columns with latitude and longitude data but I'm unable to get the transform and projection working.

Any advice?

Data:

Value1,Value2,Lat,Long
1,2,15,16
4,2,15.01,16.03
4,2,15.03,16.02

Part where I think I'm stuck at:

I've modified some of the code: pointing it to a csv, setting the map to center around my data, Using d.lat and d.long instead of d.geometry.coordinates wherever visible. I'm unable to test it as d3path.bounds gets set to +- infinities and no overlay svg is created. My feeling is that the projectPoint function 1which takes (x,y) needs some modifications but I'm unable to figure out how x and y are getting mapped to the coordinates.

TheComeOnMan
  • 12,535
  • 8
  • 39
  • 54
  • What does your data look like? How are you unable to get it working? – Lars Kotthoff Oct 11 '15 at 18:41
  • @LarsKotthoff, I've added these details to the question. – TheComeOnMan Oct 11 '15 at 23:31
  • 1
    So like in [this example](http://bl.ocks.org/sumbera/10463358)? – Lars Kotthoff Oct 11 '15 at 23:43
  • Possibly. It looks like a really busy example so let me go through it with some patience :). – TheComeOnMan Oct 12 '15 at 02:40
  • Isn't this example basically taking a CSV and converting it to a geoJSON? I have a fairly large dataset (a few MB, a few thousand rows) and I'm worried that there will be significant cost if I try to do that. Is there no way to work off of a csv itself? – TheComeOnMan Oct 12 '15 at 16:52
  • Okay, I amped up the data to about 270,000 rows and it was still almost instantaneous. Can I safely assume that performance won't be an issue then or are there any caveats? – TheComeOnMan Oct 12 '15 at 17:07
  • I wouldn't worry about it. The bottleneck is usually the rendering. – Lars Kotthoff Oct 12 '15 at 18:48
  • Thanks, @LarsKotthoff. If you can post this as an answer, I can close the question. – TheComeOnMan Oct 13 '15 at 01:05
  • Well this isn't really an answer :) Would you say that [this question](https://stackoverflow.com/questions/20987535/plotting-points-on-a-map-with-d3) is similar enough to yours to mark this one as a duplicate? – Lars Kotthoff Oct 13 '15 at 01:41
  • It doesn't answer the question of using a csv directly. If not for that, this questions basically breaks down into a convert CSV to geoJSON sort of a question. If there is a way of getting the CSV to work directly, I'd still be happier since I have other code that uses the csv format already. For now, I'm accepting that there is no performance issue on converting CSV to geoJSON and I now need to restructure the rest of my code to work with that. – TheComeOnMan Oct 13 '15 at 06:16

0 Answers0