Toblerity / Fiona

Fiona reads and writes geographic data files
https://fiona.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.14k stars 202 forks source link

'Measured 3D LineString' datatype appears to be converted to 'LineString Z' silently - add a UserWarning, and then add support for 'Measured 3D LineString' #1319

Closed DeflateAwning closed 6 months ago

DeflateAwning commented 8 months ago

When reading a dataset which contains a 'Measured 3D LineString' geometry field, the data appears to be converted to a 'LineString Z' (which is presumably a "3D LineString", per the geometry datatypes in the docs).

I would like to request that, effective immediately, a UserWarning be producted which explains this behavior. An appropriate UserWarning would be UserWarning: Measured (M) geometry types are not supported. Original type 'Measured 3D LineString' is converted to 'LineString Z' (which matches the warning given in the competing pyogrio lib).

I would also like to request that actual support be added for reading these LineStrings.

An example dataset (albeit a rather large one: 70 MB and 112,995 rows) is here: https://static.aer.ca/prd/documents/sts/st37/Township_1-25.zip (specifically, the ST37_WG_GCS_NAD83_TWP_01_25.shp shapefile).

sgillies commented 6 months ago

@DeflateAwning I'm not going to add a warning just for parity with pyogrio. I think it's well enough explained already that fiona doesn't support 3D or measured geometries well because it's based on a GeoJSON representation of geometries.

A while ago I imagined that support for all OGR geometry types would be a defining feature of 2.0. I'm not planning to do it for 1.10.

DeflateAwning commented 6 months ago

The warning is not "just for parity". It's also because doing things silently is annoying.

What makes you think removing data silently is a feature and not a bug?

The way I interfaced with fiona (via its use in GeoPandas) didn't have me learning about its GeoJson-based backend. I don't think it's reasonable to assume all users have read the full fiona docs before using it, as you're suggesting is the case