2013-10-31 42 views
0

我正在尋找(美國+加拿大)與州/省分別地圖。美國和加拿大與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.wkbconverter.py後我得到Alaska名稱StateYukon作爲Territory,就是這樣。

我在這裏錯過了什麼?

謝謝你的時間。

+0

尋找相同的地圖,你有沒有成功?將github上將是很好的 – BillPull

回答

0

我和你有同樣的問題。通過使用shapefile解決它,10m_cultural/ne_10m_admin_1_states_provinces_shp.shp從包naturalearth all vector themes. 但唯一的缺點是,輸出JS文件太大。它容易達到2MB。下次嘗試使用來自不同源的shapefile並讓你知道。但現在至少這是有效的。

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

相關問題