TopoJSON有奇怪的路径 [英] TopoJSON with strange paths

查看:118
本文介绍了TopoJSON有奇怪的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WGS84中有一个ESRI shapefile,并用 ogr2ogr 将它转换为欧洲Albers投影(EPSG:102013)。

I have an ESRI shapefile in WGS84 and convert it to another with a European Albers projection (EPSG:102013) with ogr2ogr.

ogr2ogr -f 'ESRI Shapefile' -t_srs 'EPSG:102013' europe.shp europe_data_wgs84.shp

然后我使用以下命令将其转换为TopoJSON:

I then convert it to TopoJSON using the following:

topojson --id-property iso_a3 -o europe.json -p --simplify-proportion 0.25 --width 900 --height 600 -- countries=europe.shp

然后我通过D3加载 europe.json ,并且可以成功显示它(通过将投影设置为 null ,因为它已经投影)。

I then load europe.json via D3 and can successfully display it (by setting the projection to null as it is already projected).

>

每个欧洲国家都有 .country

当我设置 .country {fill:rgb(200,200,200); }

不知怎么,路径显示不正确?我不明白,因为路径似乎没有自定义填充正常呈现。我做错了什么?

So somehow, the paths are not displayed correctly? I don't understand as the paths seem to render normally without a custom fill. What am I doing wrong?

推荐答案

已经找到问题。我有一个 topojson.mesh 层与类 .country-boundaries 在国家层之上,填充颜​​色定义。所以我不得不设置

Already found the problem. I had a topojson.mesh layer with class .country-boundaries above the country layer, and this mesh had still a fill color defined. So I had to set

.country-boundaries { fill: none; }

这篇关于TopoJSON有奇怪的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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