Il 28 feb 2020, 17:49 +0100, Just van den Broecke <jus...@gmail.com>, ha scritto: > On 28-02-20 17:29, Even Rouault wrote: > > On vendredi 28 février 2020 17:22:28 CET Francesco Bartoli wrote: > > > However, we are using both modules so how can we handle exceptions > > > properly > > > for both of them? > AFAIK we only use OGR (vector) currently within pygeoapi, no raster/GDAL > yet.
We are using both https://github.com/geopython/pygeoapi/blob/9d6322a9733313a98664d65a5d42e119802c3e3b/pygeoapi/provider/ogr.py#L101-L104 even though without any real spatial operation from GDAL > > > > You can use both gdal.UseExceptions() and ogr.UseExceptions() > My bad: in the initial version of the pygeoapi OGRProvider I added > gdal.UseExceptions() from example code (py-gdalogr-cookbook). Was not > aware of ogr.UseExceptions()! > > > > > > > > > Using ogr.UseExceptions() the > > > call > > > https://github.com/geopython/pygeoapi/pull/372/files#diff-b105ae3f7a36 > > > 059b16bdc16a08071016R361 gives the same result silently without any > > > message > > > to system output this time. > > > > On a quick test, ogr.UseExceptions() does the job for me: > > > > $ OGR_GEOJSON_MAX_OBJ_SIZE=0 python > > > > > from osgeo import ogr > > > > > ogr.UseExceptions() > > > > > ds = ogr.Open('poly.geojson') > > > > > lyr = ds.GetLayer(0) > > > > > lyr.GetNextFeature() > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "/home/even/gdal/git/gdal/gdal/swig/python/build/lib.linux-x86_64-2.7/ > > osgeo/ogr.py", line 1339, in GetNextFeature > > return _ogr.Layer_GetNextFeature(self, *args) > > RuntimeError: GeoJSON object too complex, please see the > > OGR_GEOJSON_MAX_OBJ_SIZE environment option > > > > > > > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev