【问题标题】:Visualising a custom map with QGIS and D3.js is harmed by the projection使用 QGIS 和 D3.js 可视化自定义地图会受到投影的损害
【发布时间】:2015-03-21 23:48:11
【问题描述】:

这些是我拥有的 4 个多边形:QGIS 中的http://imgur.com/vsVjxE1。我现在想将它们与 D3.js 一起使用。我已经尝试过QGIS generated shapefile malformed when converted to topojson by mapshaper 中的东西。这在旧的 json 文件上运行良好。但是当我创建一个新的时,它在垂直中间出现了问题。这就是http://jsfiddle.net/kwoxer/kpL1uyy2/5/的例子:

var projection = d3.geo.projection(function(x, y) { return [x, y];})
        .precision(0).scale(1).translate([0, 0]);
var path = d3.geo.path().projection(projection);

我也试过了:

var path = d3.geo.path().projection(null);

然后整个地图在中间被镜像了。

我认为我必须假设我没有正确使用该系统。 json 在 mapshaper 上也很好。那么你有什么技巧吗,这样我就可以画出我想要的任何东西,无论它有多大,然后 d3.js 就可以按原样绘制它。 =)

也许是

  • 规范化 lan/lng
  • 禁用 KBS

我真的不知道为什么创建自己的地图不是直截了当。

Edit1:在这里https://gis.stackexchange.com/questions/54373/either-geojson-to-topojson-conversion-problem-or-projection-issue-with-d3-js 几乎找到了我的问题,但我得到了:

C:\Program Files\GDAL>ogr2ogr.exe -f "GeoJSON" -s_srs region.prj -t_srs EPSG:432
6 asdas.json region.shp
ERROR 4: Failed to create GeoJSON datasource: asdas.json.
GeoJSON driver failed to create asdas.json

Edit2:已经找到了这个有趣的答案:https://gis.stackexchange.com/questions/14731/how-do-i-specify-a-crs-for-a-fictional-game-map-in-qgis

但是我像他一样使用了这样的投影,但在 d3.js 上仍然失败。

【问题讨论】:

    标签: javascript json d3.js projection qgis


    【解决方案1】:

    我现在只是在使用自己的投影

    +proj=eqc +a=1790493.11 +lat_ts=0 +lon_0=0 +rf=800 +units=m +no_defs
    

    有了这个投影,一切都很好。

    【讨论】:

      猜你喜欢
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 2012-08-14
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多