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

bug: geozero null values are coerced to "null" #588

Closed
deanm0000 opened this issue Mar 27, 2024 · 2 comments · Fixed by #619
Closed

bug: geozero null values are coerced to "null" #588

deanm0000 opened this issue Mar 27, 2024 · 2 comments · Fixed by #619

Comments

@deanm0000
Copy link

I downloaded this geojson but I can't open it.

I get PanicException: Trying to insert a column value null in the wrong type column Float64(PrimitiveBuilder { values_builder: BufferBuilder { buffer: MutableBuffer { data: 0x30ffc80, len: 8, layout: Layout { size: 64, align: 128 (1 << 7) } }, len: 1, _marker: PhantomData<f64> }, null_buffer_builder: NullBufferBuilder { bitmap_builder: Some(BooleanBufferBuilder { buffer: MutableBuffer { data: 0x303a480, len: 1, layout: Layout { size: 64, align: 128 (1 << 7) } }, len: 1 }), len: 0, capacity: 1 }, data_type: Float64 })

@kylebarron
Copy link
Member

Thanks! I'll take a look!

@kylebarron
Copy link
Member

Well, the issue here is that geozero doesn't have a null variant in their type system, so they cast any null GeoJSON value to the string "null". So you have a column that starts off with float numeric values, but then has null values, so I'm trying to add the string "null" to a float column. This is a significant problem.

I don't really want to scan every input value for the string "null". I created georust/geozero#206 for discussion, which would solve this problem.

In any case, you can use read_pyogrio to read the GeoJSON using GDAL instead of geozero.

@kylebarron kylebarron changed the title panic when opening geojson geozero null values are coerced to "null" Mar 28, 2024
@kylebarron kylebarron changed the title geozero null values are coerced to "null" bug: geozero null values are coerced to "null" Mar 28, 2024
kylebarron added a commit that referenced this issue May 8, 2024
### Change list

- Support writing Struct, Array, Datetime columns from GeoArrow through
geozero.
- Vendor geozero GeoJSON updates
(georust/geozero#208 and
georust/geozero#206)
- Handle null attribute values when writing to geozero.
- add `writeGeoJSON` to JS binding
- 

Closes #588. 

~~I'm still getting issues with the GeoJSONWriter excluding fields. In
particular, writing Overture data to GeoJSON completely omits list and
struct fields, giving invalid GeoJSON with ", ,"~~

---- 

Note: tested this via the Python API
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.

2 participants