我一直在繪製地圖幾周,但每次我有這種geojson文件(Featurecollection)。卡薩布蘭卡的不同鄰域座標Basicaly多個陣列(在我的例子)D3js地圖:GeometryCollection Vs FeaturesCollection
{ 「類型」: 「的FeatureCollection」, 「CRS」:{ 「類型」: 「姓名」, 「屬性」:{ 「名稱「:」urn:ogc:def:crs:OGC:1.3:CRS84「}},」features「:[{」012「]」Feature「,」properties「 「arrondissement」:「Hay Hassani」,「縣」:「Hay Hassani」, 「Population」:18930,「area」:1616340.045},「geometry」:{ 「type」:「Polygon」,「coordinates」 :[ [ [-7.686476562432639,33.559325447129368], [-7.690429687499997,33.557167523684669 ], [-7.690712466572602,33.55630146957499], [-7.69193172454834,33.557239049346535], [-7.6959228515625,33.56135167528992], [-7.696309089660644,33.561208630718284], [-7.696545124053955,33.561494719624619], [-7.697145938873291,33.561584122213503] [-7.698111534118651,33.562549664276048], [-7.696180343627932,33.56406947713436], [-7.698715871374095,33.566658445267336], [-7.697645503668443,33.567405785590324], [-7.697098054802192,33.567712878788591], [-7.696259117371391,33.568261506969215], [ -7.69601151134932 5,33.5683181977139], [-7.697387200000034,33.570266599999982], [-7.696740007740531,33.570256969950947], [-7.695561836061942,33.570528261065235], [-7.694268410063101,33.570921223641093], [-7.693596744041679,33.571075056616195], [-7.692447518598163, 33.571143296338079], [-7.69142000156123,33.571163408675481], [-7.690155388704593,33.57138033300906], [-7.689247978305328,33.571612665313971], [-7.688806874513382,33.571727285593433], [-7.688311409275937,33.571857958148009], [-7.687409400000027,33.572054400000049] , [-7.687391678068598,33.572059961946792], [-7.684979438782096,33.568718150423749], [-7.683219909667969,33.565678661594823], [-7.683406457011668,33.563482296958043], [-7.683829534164441,33.562429900601146], [-7.686476562432639,33.559325447129368] ]]} },{「type」:「Feature」,「properties」:{「name」:「nassim」,「arrondissement」:「Hay Hassani」,「prefecture」:「Hay Hassani」,「Population」:18898,區「:4776317.152}, 」幾何「:{ 」類型「: 」多邊形「, 」座標「:[ [ [-7.665259712372787,33.530737914470194], [-7.663579428308825,33.5378162517151], [-7.660416146883682,33.53687582432655], [-7.653830735645996,33.533727400613216], [-7.653876700000025,33.5326443], [-7.65348,33.531745500000149], [-7.653190299999866,33.529947799999803], [-7.652943599999785,33.528677899999671], [ -7.653615699999913,33.526604099999851], [-7.653936200000107,33.525365200000174], [-7.654509399999957,33.5241387], [-7.655106500000205,522667000000347], [-7.656280299999967,33.520306199999879], [-7.656956199999512,33.519349099999339], [-7.658114900000093,33.517926900000134], [-7.658983900000114,33.516343700000149], [-7.659490200000375,33.515535600000646], [-7.6601104,33.5145457] , [-7.660947299999948,33.513347099999926], [-7.662599500000061,33.511602700000104], [-7.664262500000047,33.510654500000086], [-7.666333199999984,33.509563099999966], [-7.668178499999983,33.50827], [-7.668900600000119,33.507543800000242], [-7.669823299999847,33 0.506934599999816], [-7.670733100000266,33.507059900000414], [-7.673713600000018,33.50863970000001], [-7.676073900000079,33.509053], [-7.68223779133892,33.508502572767156], [-7.684989189541704,33.508844023847608], [-7.683734893798827,33.512559745083195 ], [-7.675151824951172,33.519357925734134], [-7.674551010131836,33.520717497758142], [-7.671031951904296,33.524796085610056], [-7.668800354003906,33.526441777122507], [-7.668285369873048,33.528516734826688], [-7.665259712372787,33.530737914470194] ]]} } ....
現在,因爲我是從開放街道地圖http://polygons.openstreetmap.fr/index.py我遇到這種類型的GeoJSON的(GeometryCollection的)的特定鎮出口GeoJSON的文件(無居民區,僅一個鎮的形式)
{ 「類型」: 「的GeometryCollection」, 「幾何結構」:[{ 「類型」: 「的MultiPolygon」, 「座標」:[[[[ - 5.9429266,35.745548300000003],[ - 5.9379208,35.743288800000002],[ -5.9327023,35.7417388],[ - 5.9272307,35.741231999999997],[ - 5.9202848,35.741909499999998],[ - 5.9166306,35.746408000000002],[ - 5.9156028,35.7496942],[ - 5.9046272,35.760035999999999],[ - 5.9001726,35.762371000000002],[ - 5.8900896,35.7656931],[ - 5.8790518,35.756111199999999],[ - 5.8770798,35.7525 902],[ - 5.8737711,35.745343900000002],[ - 5.872858,35.742017500000003],[ - 5.8727035,35.741004699999998],[ - 5.8699858,35.732553199999998],[ - 5.869492,35.731017299999998],[ - 5.8673423,35.728874099999999],[ - 5.8638447,35.7260068 ],[ - 5.8619479,35.7246934],[ - 5.8556436,35.720934100000001],[ - 5.8510603,35.719324399999998],[ - 5.8464426,35.716996799999997],[ - 5.8434943,35.714585599999999],[ - 5.8387091,35.711292700000001] ....
這裏是我的問題:
- 當我嘗試繪製一個GEOMETRYCOLLECTION GeoJSON的類型的地圖,我遇到一個空白點一個巨大的廣場,是不是因爲我只是有1單協調陣列ates並不像第一個例子那樣多?
- 我怎樣才能構建一個新的geojson文件,以使用Geomtrycollection的座標到FeatureCollection中(因爲它僅適用於該類型)?
我一直在尋找很多Tip 1這裏Tip 2這裏Tip 3 但我找不到我的答案
感謝你們的幫助
更新,你可以請分享,實際上繪製地圖的代碼? – elias
@Elias,這裏是Plunker鏈接:http://plnkr.co/edit/MbhmpGmi4nP7o3xR1Cxg?p=info 2個json文件(帶有原始FeatureCollection和FeatureCollection測試的馬拉喀什,基於我從Openstreetmap得到的GeometryCollection類型創建.Thx – MFAMOROCCO