Geojson file not loading!

Hi there,

I have geojson files of buildings exported through Qgis from shapefiles..
its code seems fine to me but it just does not load!

can someone help me out...
it can go directly in the hello world example with the following code:

var dataSource = Cesium.GeoJsonDataSource.load('geovogatic/test.geojson');
  viewer.dataSources.add(dataSource);
    
and the sample geojson code is as follows:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } },
"features": [
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20001", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268271.634355565009173, 2705856.544927590060979 ], [ 268272.490466132003348, 2705858.804040470160544 ], [ 268272.490466132003348, 2705858.804040470160544 ], [ 268271.634355565009173, 2705856.544927590060979 ], [ 268271.634355565009173, 2705856.544927590060979 ] ] ] } },
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20002", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268275.632829423004296, 2705855.029670979827642 ], [ 268271.634355565009173, 2705856.544927590060979 ], [ 268271.634355565009173, 2705856.544927590060979 ], [ 268275.632829423004296, 2705855.029670979827642 ], [ 268275.632829423004296, 2705855.029670979827642 ] ] ] } },
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20003", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268275.446774897980504, 2705854.538708500098437 ], [ 268275.446774897980504, 2705854.538708500098437 ], [ 268275.632829423004296, 2705855.029670979827642 ], [ 268275.632829423004296, 2705855.029670979827642 ], [ 268275.446774897980504, 2705854.538708500098437 ] ] ] } },
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20004", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268278.13373798399698, 2705853.520462090149522 ], [ 268275.446774897980504, 2705854.538708500098437 ], [ 268275.446774897980504, 2705854.538708500098437 ], [ 268278.13373798399698, 2705853.520462090149522 ], [ 268278.13373798399698, 2705853.520462090149522 ] ] ] } },
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20005", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268278.324060110026039, 2705854.021603310015053 ], [ 268278.13373798399698, 2705853.520462090149522 ], [ 268278.13373798399698, 2705853.520462090149522 ], [ 268278.324060110026039, 2705854.021603310015053 ], [ 268278.324060110026039, 2705854.021603310015053 ] ] ] } },
{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbHatch", "ExtendedEntity": null, "Linetype": null, "EntityHandle": "20006", "Text": "SOLID" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 268282.453285931027494, 2705852.456797100137919 ], [ 268278.324060110026039, 2705854.021603310015053 ], [ 268278.324060110026039, 2705854.021603310015053 ], [ 268282.453285931027494, 2705852.456797100137919 ], [ 268282.453285931027494, 2705852.456797100137919 ] ] ] } },
] }

Thank you

Hi there,

It looks like your geojson is malformed. I tried loading it with this code: cesiumjs.org/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=576ac17246ed92689d044de7653e10b7

I’d recommend checking your data file.

I got this error: “SyntaxError: Unexpected token ] in JSON at position 3254”

Hope that helps,

  • Rachel

After correcting the formatting problem (extra comma before closing square bracket), you’ll discover that the CRS is not supported (EPSG 3857). Have a look at https://groups.google.com/forum/#!topic/cesium-dev/A0YThz9IF5c for ideas on how to reproject your data.

Hope that helps.

Scott