问题
Once again i'm searching for some help.
I manage to draw my map but when i attempt to add circles (stores locations from csv), my points appears in the left corner and i'm getting the following errors
> Error: <circle> attribute cx: Expected length, "NaN". Error: <circle>
> attribute cy: Expected length, "NaN". Error: <circle> attribute r:
> Expected length, "NaN".
I read many posts here in stack and i read the basic tutorial from Mike Bostock but can't manage to have my points at the right place
So i'm wondering if the projection of the circles i'm using is not the cause of this behaviour i'm seeing
Please find here my plunker
N.B : I deliberately used the same json file twice in my if function, please don't mind this point
Thank you very much for your help
回答1:
There are two things that come to mind:
Your CSV headers (Lon,Lat) do not match the properties you use to center the circles (lon, lat).
There is an error in your csv:
13,33.243161-8.512494999999944,Station13,1672473
(It's missing a comma).
If you think you are having problems with the projection, the easiest way to confirm this is to test a point out:
console.log(projection[0,0]);
If you get a SVG coordinate back, your projection is likely not the issue. Instead the issue is likely with what you are feeding the projection or the inline formula that uses the data projection returns.
来源:https://stackoverflow.com/questions/42700208/d3js-circles-on-a-map-projection-issue