Closed Farkal closed 5 years ago
Hi thanks for reporting an error 😄
For the Float parsing yes the code is wrong and i will accept a PR correcting it.
For the second error, the issue is bigger and affects more .dbf types (if not all) (Character, bool, Numeric, Date, etc) where a field can be uninitialied and will be written with only space to fill the length of the field.
The PR #1 shows that we had a problem parsing the Date type when the field was unitialzed and written with only spaces.
So I think what we would have to do is use the Option<T>
to wrap FieldValue
,
I have created the pull request. I also see you change the implementation with Option but i still get thread 'test_my_file' panicked at 'called
Result::unwrap()on an
Errvalue: ParseFloatError(ParseFloatError { kind: Invalid })'
when i try to parse float encoded with None
.
Yes, I was waiting for you to do the PR that fixes this 😁
Sorry i was thinking you wanted to do it yourself. I just create a second PR #4 . Could you release new version after this merge ? I use a lib that depend on your's 😉
Fixed by #4
Hi and thanks for your lib. I have find that float parsing was wrong because you still need to read the field length. You just need to use the same code for Numeric and for Float but with parsing as f32 for float:
field.rs
I found another issue with some python lib encoding shapefile: To be able to run the script you will need to have python 3.6 and run
pip install pyshp
If we encode dbf with
None
value the decoding fail. Lot of lib have the same behavior but mapshaper.org work great with this values. I think we should be able to decode this values.If you want i can create merge request and add my tests 😉