Option skip unparse-able DBF fields#18
Merged
Merged
Conversation
Owner
|
Thank you for both your kind words and this excellent PR full of tests :) Yup, this PR makes total sense. I'll merge it now. Do you have more PRs in the pipeline? If not, I'll tag a new version of go-shapefile after merging so you have a clean version for your |
Contributor
Author
|
Thank you for accepting my PR! I'm incorporating |
Owner
|
OK, I tagged |
irees
added a commit
to interline-io/transitland-lib
that referenced
this pull request
May 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-shapefileto 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
ogr2ogris to ignore fields that fail to parse (setting the value to null), and continue processing additional records in the shapefile. Currently,go-shapefilestops processing and returns an error in this case.To match the
ogr2ogrbehavior, I'd like to propose a new option inReadDBFOptionscalledSkipBrokenFields, 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 whenSkipBrokenFieldsis set, for both the normal reader and the Scanner reader.I'm open to feedback and alternate approaches. Please let me know your thoughts.