美国和加拿大的jvectormap

时间:2013-10-31 17:07:34

标签: converter jvectormap

我正在寻找(美国+加拿大)和州/省的地图。

这就是我到目前为止所做的:

  • here;
  • 下载jVectorMap 1.2.2
  • 阅读this后,安装了GDAL和Shapely;
  • Natural Earth下载10m Admin 1个包裹;

根据this帖子,可以使用以下内容完成我需要的操作:

python converter.py --width 900 --country_name_index 12 --country_code_index 18 --longitude0 -100 --where="iso_a2 = 'CA' OR iso_a2 = 'US'" --projection lcc --name us_ca ne_10m_admin_1_states_provinces_shp/ne_10m_admin_1_states_provinces_shp.shp ../jquery-jvectormap-us-ca-lcc-en.js

其中--country_name_index 12 --country_code_index 18部分对我没有任何意义,因为我正试图转换2个国家。

无论如何,在运行建议的代码后我得到:

Traceback (most recent call last):
  File "converter.py", line 296, in <module>
    converter.convert(args['output_file'])
  File "converter.py", line 144, in convert
    self.loadData()
  File "converter.py", line 89, in loadData
    self.loadDataSource( sourceConfig )
  File "converter.py", line 130, in loadDataSource
    shapelyGeometry = shapely.wkb.loads( geometry.ExportToWkb() )
AttributeError: 'module' object has no attribute 'wkb'

我觉得这很奇怪,除非我在安装中遗漏了一些东西。 将import shapely.wkb添加到converter.py后,我的Alaska名称为StateYukonTerritory,就是这样。

我在这里缺少什么?

感谢您的时间。

2 个答案:

答案 0 :(得分:0)

我和你有同样的问题。通过使用包naturalearth all vector themes.中的shapefile 10m_cultural / ne_10m_admin_1_states_provinces_shp.shp 解决了这个问题 但唯一的缺点是输出JS文件太大了。它容易达到2MB。我将尝试下次使用不同来源的shapefile并告知您。但至少现在这个有用了。

答案 1 :(得分:0)

构建大陆地图时遇到了同样的问题。解决方法是使用较旧的convert.py版本(1.1.1而不是1.2.2)。您仍然需要输入--country_name_index和--country_code_index标志,以便提供您想要的任何值作为值。制作的地图很好。 convert.py 1.1.1可以在这里找到: https://github.com/jfhovinne/jvectormap-maps-builder

相关问题