我試圖在基於標準HelloWorld示例應用程序的測試應用程序中加載以下geoJson文件。Cesium - 範圍錯誤:驗證的geoJson上的數組長度無效
{
"type": "FeatureCollection",
"generator": "overpass-turbo",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.",
"timestamp": "2016-09-12T19:22:48Z",
"features": [
{
"type": "Feature",
"id": "way/442106309",
"properties": {
"@id": "way/442106309",
"addr:city": "Ottawa",
"addr:housenumber": "999",
"addr:postcode": "H8G8F9",
"addr:street": "My Road",
"building": "apartments",
"building:levels": "3",
"levels": "3"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-75.7337391,
45.3783003
],
[
-75.7335222,
45.378383
],
[
-75.7335439,
45.3784096
],
[
-75.733525,
45.3784206
],
[
-75.7335406,
45.3784375
],
[
-75.7335003,
45.378453
],
[
-75.7335867,
45.378543
],
[
-75.7338474,
45.3784262
],
[
-75.7337391,
45.3783003
]
]
]
}
}]}
我加載這個使用下面的代碼:
var dataSource = Cesium.GeoJsonDataSource.load('../data/kirkwood.json').then(function(data) {
viewer.dataSources.add(data);
viewer.zoomTo(data);
}
這將導致以下錯誤消息:
An error occurred while rendering. Rendering has stopped.
RangeError: Invalid array length
RangeError: Invalid array length
at updateFrustums (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:155215:36)
at createPotentiallyVisibleSet (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:155389:13)
at executeCommandsInViewport (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:155943:9)
at updateAndExecuteCommands (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:155841:17)
at render (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:156177:9)
at Scene.render (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:156215:13)
at CesiumWidget.render (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:164962:25)
at render (http://127.0.0.1:8081/Build/CesiumUnminified/Cesium.js:164364:32)
我很困惑,因爲以GeoJSON驗證就好使用http://geojson.io和http://geojsonlint.com
任何人都可以提供一些有用的建議?
謝謝!
你是對的。我是這裏的罪魁禍首。 在我的開發中,我決定切換到另一個數據源以簡化我的調試過程(只有一個功能),而我的代碼沒有顯示的是我正在循環geoJson的功能並執行一些基於新數據集中不存在的屬性。我的錯... :/ –