Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapefile export-import workflow #12

Closed
surkova opened this issue Feb 11, 2015 · 4 comments · Fixed by #13
Closed

Shapefile export-import workflow #12

surkova opened this issue Feb 11, 2015 · 4 comments · Fixed by #13

Comments

@surkova
Copy link

surkova commented Feb 11, 2015

I'm working on a project that allows export of drawn geometries as shapefile and import of shapefiles for presentation on the map.

Right now I'm trying to implement the workflow when you can draw a feature, export it as shapefile, drag'n'drop it on the page again and it will be imported.

For shapefile export I'm using shp-write library, which is dependent on your lib, and shapefile-js for import. When the latter is trying to parse dbf file created by your library, I receive "Offset is outside the bounds of the DataView" in latest Chrome (there must be at least one property present for the feature in geojson, but it's another bug).

I have tried to open exported shapefile in QGIS and save it again, then shapefile-js library has no troubles parsing the created dbf. So I guess there's some difference between the dbf created by javascript vs. dbf created by QGIS. Any ideas where the bug might be?

@stollc
Copy link

stollc commented Oct 20, 2015

I'm having the same issue. Any solution for this?

@surkova
Copy link
Author

surkova commented Oct 20, 2015

@stollc unfortunately no 👎

@kriscarle
Copy link
Contributor

I got this error when one of my fields was not in the supported types, meaning detected in JavaScript as typeof string, boolean, or number. In my case, I had an object inside my GeoJSON properties that I needed to stringify.

When it doesn't detect the type, the buffer size attempts to multiple by a NaN and ends up being empty, causing the DataView to allocate 0 bytes, therefore writes to the DataView are outside of bounds.

@mrumeau
Copy link

mrumeau commented Feb 5, 2016

In the shp-write library, there is an error when setting the terminator of the dbf header.
line 2882, replace view.setUint8(fieldDescLength - 1, 13) by view.setUint8(32 + fieldDescLength - 1, 13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants