Option skip unparse-able DBF fields #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hi @twpayne
I use your excellent libraries extensively in my work. Thank you so much for making my projects possible - I would not have been able to use Go otherwise.
I'd like to use
go-shapefile
to load various shapefiles in my system, and replace a shell script that usesogr2ogr
.However, there's one significant behavior difference that is preventing me from doing this (without otherwise pre-processing the files). The default behavior of
ogr2ogr
is to ignore fields that fail to parse (setting the value to null), and continue processing additional records in the shapefile. Currently,go-shapefile
stops processing and returns an error in this case.To match the
ogr2ogr
behavior, I'd like to propose a new option inReadDBFOptions
calledSkipBrokenFields
, which when set simply ignores errors returned byParseRecord
.I've included a test file (Natural Earth 10m Populated Places, which has
**
as a value in an integer field and demonstrates the error) and tests that check both the expected error behavior and behavior whenSkipBrokenFields
is set, for both the normal reader and the Scanner reader.I'm open to feedback and alternate approaches. Please let me know your thoughts.