2014-01-21 25 views
0

我想在csv查看器中加載一個csv,其中包含一個geojson多邊形的列,但我不能這樣做。在CSV查看器中加載geojson多邊形

我正在使用ckan 2.2。

我有這個CSV:

NAME,GEOJSON 

"P1", "{""type"":""Polygon"",""coordinates"": [[9.0114910478323 , 45.35880131440966], [9.014491488013135 , 45.35880097314403], [9.0144909480813 , 45.35668565341486]]}" 
"P2", "{""type"":""Polygon"",""coordinates"": [[9.014491488013135 , 45.35880097314403], [9.017491928134044 , 45.358800553060284], [9.017491276410173 , 45.35668523336193]]}" 
"P3", "{""type"":""Polygon"",""coordinates"": [[9.017491928134044 , 45.358800553060284], [9.02049236818262 , 45.35880005415845], [9.020491604666724 , 45.356684734496675]]}" 

我想在CSV查看器來加載,選擇地圖和GeoJSON的,但多數民衆贊成沒有工作。

我可以加載點但沒有多邊形。此查看器中是否有可加載的多邊形?

這個CSV工作有兩點:

NAME,GEOJSON 

"P1", "{""type"":""Point"",""coordinates"":[-3.620039398822976,40.41977058365936]}" 
"P2", "{""type"":""Point"",""coordinates"":[-3.72974339439061,40.41108768721466]}" 
"P3", "{""type"":""Point"",""coordinates"":[-3.702445264167018,40.3876818541849]}" 

回答

1

是的,這CKAN使用Recline瀏覽器支持所有GeoJSON的幾何形狀。

的問題是,你的多邊形是不正確的,你需要:

  1. 一組額外的在你的座標[](見spec
  2. 通過重複第一座標對
  3. 閉上你的多邊形

所以這個文件將工作(你可能需要5個座標對來繪製一個正方形多邊形):

name,geom 
"P1", "{""type"":""Polygon"",""coordinates"": [[[9.0114910478323 , 45.35880131440966], [9.014491488013135 , 45.35880097314403], [9.0144909480813 , 45.35668565341486],[9.0114910478323 , 45.35880131440966]]]}" 
"P2", "{""type"":""Polygon"",""coordinates"": [[[9.014491488013135 , 45.35880097314403], [9.017491928134044 , 45.358800553060284], [9.017491276410173 , 45.35668523336193],[9.014491488013135 , 45.35880097314403]]]}" 
"P3", "{""type"":""Polygon"",""coordinates"": [[[9.017491928134044 , 45.358800553060284], [9.02049236818262 , 45.35880005415845], [9.020491604666724 , 45.356684734496675],[9.017491928134044 , 45.358800553060284]]]}" 

看到它在行動here

+0

你編輯斜倚js? – Niths

+0

不,我剛剛編輯了原始CSV文件 – amercader

+0

我有一個疑問..我怎樣才能改變多邊形的顏色。我需要像http://leafletjs.com/examples/choropleth.html這樣的地圖 – Niths