5

I've got a shapefile (.shp, .shx, .dbf, and .prj) that I'm trying to save as a GeoJSON using QGIS 2.14. When I load the .shp into QGIS, everything seems to work fine, the Shapefile renders properly.

QGIS Shapefile

However, when I try to do a Save As and select GeoJSON, I get null values for all my GeoJSON coordinate values.

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

"features": [
{ "type": "Feature", "properties": { "Section": null, "Block": "Last Name, First Name" }, "geometry": { "type": "MultiPolygon", "coordinates": null } },
{ "type": "Feature", "properties": { "Section": null, "Block": "Last Name, First Name" }, "geometry": { "type": "MultiPolygon", "coordinates": null } },
{ "type": "Feature", "properties": { "Section": null, "Block": "Last Name, First Name" }, "geometry": { "type": "MultiPolygon", "coordinates": null } },
{ "type": "Feature", "properties": { "Section": null, "Block": "Last Name, First Name" }, "geometry": { "type": "MultiPolygon", "coordinates": null } },
{ "type": "Feature", "properties": { "Section": null, "Block": "Last Name, First Name" }, "geometry": { "type": "MultiPolygon", "coordinates": null } },
etc, etc..............

Is there something special I need to do to make sure my coordinates show up when I'm saving my data?

9
  • Does the original data have a valid coordinate system defined in the prj file? Commented Jun 4, 2016 at 23:20
  • It does. This is the .prj file: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
    – BDD
    Commented Jun 4, 2016 at 23:33
  • Strange. This isn't quite an answer (doesn't solve it in QGIS), but you could use the ogr2ogr command line tool (included in QGIS, see gdal.org/ogr2ogr.html) to convert from shapefile to GeoJSON, hopefully without this issue. Commented Jun 5, 2016 at 0:39
  • 1
    Here is a snippet of the ogrinfo -al. There are coordinates, but there is a nan value that I think is the z value. Would that affect it?
    – BDD
    Commented Jun 5, 2016 at 14:52
  • 2
    Maybe, try forcing 2D with -dim 2 in ogr2ogr. Example: ogr2ogr -f "ESRI Shapefile" -dim 2 output_2D.shp input_3D.shp like suggested here
    – thibautg
    Commented Jun 5, 2016 at 16:22

1 Answer 1

1

If you don't want to use ogr2ogr @ machine, could also use web client for this transformation .shp to GeoJSON- https://ogre.adc4gis.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.