geojson.io icon indicating copy to clipboard operation
geojson.io copied to clipboard

Exported shapefile faulty

Open KcOOE opened this issue 2 years ago • 7 comments

We use geojson.io to convert geojson files into shapefiles. Unfortunately, recently this no longer works correctly if there is more than one polyline (or polygon) in the geojson. The exported shapefile can then no longer be opened in ArcMap/ArcGIS Pro. It also doesn't open correctly in QGIS.

KcOOE avatar May 03 '23 08:05 KcOOE

this happened to me too

claudinehellmuth avatar May 12 '23 16:05 claudinehellmuth

I'm unable to reproduce this with simple drawn features in geojson.io. I did the same workflow for polygons and polylines:

  • draw two polygons/polylines on geojson.io
  • download as a shapefile
  • unzip, open in QGIS 3.22.9 (macos), no issues with import.

Can someone provide example geojson that is not exporting to shapefile correctly?

chriswhong avatar Jun 02 '23 15:06 chriswhong

  • In QGIS (3.22.4) now I can also load the shapefile with two polygon/polyline features.
  • In ArcMap/ArcGISPro you get the error "Number of shapes does not match the number of table records".
  • If you check the shapefile on mapshaper.org you also get an error -> "Mismatched .dbf and .shp record count".
  • If yout draw one polygon/polyline on geojson.io there is no problem, but if you draw two or more polygons/polylines then you get the error.

KcOOE avatar Jun 07 '23 06:06 KcOOE

I have this issue too. I suspect this is because the corresponding .dbf file doesn't match the attribute number in the shapefile itself. But QGIS doesn't have strict inspection on this so you can still open the file itself. If you try to open the attribute list in QGIS you will find it blank, which is not allowed in the first place according to ArcGIS.

ChenpengZhang avatar Mar 14 '24 11:03 ChenpengZhang

I have experienced this issue too. Attached, you'll find two shapefiles. 1-square is perfectly fine, 2-square has the mismatch record count issue.

According to the dBASE file specification, the number of records is located at bytes 4-7. This is correct in both .dbf files.

This implies the bug could lie within the generation of the .shp file.

1-square.zip 2-squares.zip

PS: I tried uploading the shapefile into mapshaper. It showed the same mismatch warning.

leahnder avatar Apr 29 '24 12:04 leahnder

fyi this is a problem with the shp-write library mapbox/shp-write#113

calvinmetcalf avatar Oct 16 '24 14:10 calvinmetcalf