geopython / geopython-workshop

The Doing Geospatial in Python Workshop (mainly provided at FOSS4G events)
https://geopython.github.io/geopython-workshop
Other
54 stars 22 forks source link

buffer warning #167

Closed pvgenuchten closed 2 weeks ago

pvgenuchten commented 2 weeks ago

image

can we prevent the warning?

tomkralidis commented 2 weeks ago

Thanks @pvgenuchten.

@justb4 do we want to suppress warnings with ogr.DontUseExceptions, or do we want to keep to make a discussion point about GDAL/OGR warning handling?

justb4 commented 2 weeks ago

Ok, this is a good educational point: think this comes from a more recent OGR than last workshop. When using OGR from Python it is good practice to enable Exceptions. This is what we do e.g. in the pygeoapi OGR Provider init():

    # Exceptions will get raised on anything >= gdal.CE_Failure
    self.gdal.UseExceptions()

See https://pcjericks.github.io/py-gdalogr-cookbook/gdal_general.html#enable-python-exceptions. Will devote a couple of lines in Notebook.

justb4 commented 2 weeks ago

(and prevent the warning).