使用GeoJSON和Gdal将附加数据与Shapefile组合 [英] Combining additional data with Shapefile using GeoJSON and Gdal

查看:187
本文介绍了使用GeoJSON和Gdal将附加数据与Shapefile组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Mike Bostock的伟大教程,使用下载的shape文件创建一个简单的地图,并使用GDAL将其处理到GeoJSON文件中。

I used Mike Bostock's great tutorial to make a simple map using downloaded shapefiles and processing them with GDAL into GeoJSON files.

http://bost.ocks.org / mike / map /

我试图通过采用县级shapefile地图并结合其他人口统计数据),以便我可以加载一个GeoJSON文件,而不必使用Javascript来合并数据在运行时。

I'm trying to build on this learning by taking a county-level shapefile map and marrying it with additional demographic data (CSV) so that I can load a single GeoJSON file and not have to use Javascript to merge the data at runtime. The goal is to have a county-level heatmap.

CSV文件的ID列如下所示: 01348 。而Shapefile有两个ID列: 01 348

The CSV file has an ID column that looks like this: 01348. While the Shapefile has two ID columns that are 01 and 348.

是否可以使用GeoJSON存储此类数据?

Is it possible to use GeoJSON to store this kind of data? If so, what kind of terminal commands must I use to combine the two?

推荐答案

小技巧:


  1. 将Shape文件转换为GeoJSON时,保留id-a:01;id-b:348 作为此顺序中的邻居。

  2. 使用简单的正则表达式删除所有;id-b:,因此获取id-a:01348

  3. ID,请参阅:如何向topojson文件中添加属性?

  1. When converting from Shape file to GeoJSON, keep "id-a":"01";"id-b":"348" as neighbors in this order.
  2. use a simple regex to delete all ";"id-b":" and thus obtain "id-a":"01348".
  3. go ahead to inject your CSV property given the common ID, see: How to add properties to topojson file?

这应该可以工作。

这篇关于使用GeoJSON和Gdal将附加数据与Shapefile组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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