Following on from GDAL/OGR Geometry Type Python, what is the best way to determine if a vector geometry is any kind of line or point or whatever?
For example, I'm using this technique at the moment,
# check geom type is supported
vector_lyr = vector_ds.GetLayer()
ftr = vector_lyr.GetNextFeature()
geom = ftr.GetGeometryRef()
geom_type = geom.GetGeometryType()
if geom_type in (ogr.wkbLineString, ogr.wkbMultiLineString):
do_line_stuff()
elif geom_type in (ogr.wkbPoint, ogr.wkbMultiPoint):
do_point_stuff()
else:
raise NotImplementedError(
'Geometry Type {} is not supported'.format(geom.GetGeometryName()))
but it feels like it doesn't cover all geometry types. What if it's a curve, or a ring, or a geometry collection? Should I just list all the possible types in the if statements above, or is there a better way? There doesn't seem to be a catch-all is_line() method.