D3js在地图上圈出:投影问题? [英] D3js circles on a map : Projection Issue?

查看:300
本文介绍了D3js在地图上圈出:投影问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我再次寻求帮助.

我设法绘制了地图,但是当我尝试添加圆(从csv存储位置)时,我的点出现在左上角,并且出现以下错误

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".

我在这里阅读了很多文章,并且阅读了Mike Bostock的基本教程,但是我的观点不能正确地放在正确的位置

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

请在此处我的朋克车

N.B:我故意在if函数中两次使用相同的json文件,请不要介意这一点

N.B : I deliberately used the same json file twice in my if function, please don't mind this point

非常感谢您的帮助

推荐答案

我想到了两件事:

  1. 您的CSV标头(Lon,Lat)与您用来使圆心居中的属性(lon,lat)不匹配.

  1. Your CSV headers (Lon,Lat) do not match the properties you use to center the circles (lon, lat).

您的csv中有一个错误:13,33.243161-8.512494999999944,Station13,1672473(缺少逗号).

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]); 

如果重新获得SVG坐标,则可能不是投影问题.取而代之的是,您提供的投影内容或使用数据投影返回的内联公式可能会出现问题.

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.

这篇关于D3js在地图上圈出:投影问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆