0

I am working with a set of line features (roads) that are represented as "polyline ZM" in shapefiles. However, when using geopandas/fiona to read the shapefiles, the return geometry is always LineString Z. I read online that GDAL supports reading M-values from shapefiles.

I am wondering if there is a way I can load the M-values from shapefiles in python. Because so far I haven't had any luck in my googling, maybe I am just not looking into the right places.

(P.S. I prefer not to use arcpy if possible) Thanks in advance!

Lucas Yu
  • 13
  • 1
  • You might want to check out gis.stackexchange.com. Also, when asking questions it is helpful to include both the code you tried and the results you got. – Erik Nov 05 '21 at 23:32

1 Answers1

1

Geopandas can't properly read geometries with M-values. This seems to be an upstream problem with the libraries that GeoPandas uses. See these github issue threads for more info:

Sadly, it doesn't seem like it's getting fixed anytime soon.

If you want, you can also use the Python GDAL/OGR libraries. It is SIGNIFICANTLY more cumbersome than using GeoPandas, but it does support geometries with M-values. See the following links for more explicit examples on how to use them:

Felipe D.
  • 1,157
  • 9
  • 19