OGR: setting a spatial filter on an empty layer triggers a GDAL error #5317

Closed
rouault opened this Issue Sep 2, 2016 · 1 comment

Projects

None yet

2 participants

@rouault
Contributor
rouault commented Sep 2, 2016

Reported in b007fdb#commitcomment-18876350 by @ruhri

when selecting/filtering data from OGR/Spatialite for map-layer, I get an Error from mapserver, if there are no matching features in datasource (Spatialite) - which is OK in this case, because sometimes it can happen, that data for this layer is empty.

[Fri Sep 2 07:09:39 2016].197319 CGI Request 4 on process 19200
[Fri Sep 2 07:09:39 2016].198665 msDrawMap(): rendering using outputformat named PNG (AGG/PNG).
[Fri Sep 2 07:09:39 2016].198683 msDrawMap(): WMS/WFS set-up and query, 0.000s
[Fri Sep 2 07:09:39 2016].200410 msOGRFileOpen(): Falling back to MapServer only evaluation
[Fri Sep 2 07:09:39 2016].200632 msOGRFileNextShape(): OGR error. Invalid geometry field index : 0
[Fri Sep 2 07:09:39 2016].200644 msDrawMap(): Image handling error. Failed to draw layer named 'poi_unterkuenfte_aggregiert'.
[Fri Sep 2 07:09:39 2016].200657 mapserv request processing time (msLoadMap not incl.): 0.003s
[Fri Sep 2 07:09:39 2016].200662 msFreeMap(): freeing map at 0xdcb3a0.

Note: after analysis this only happens when taking the non optimized code path (due to the WHERE clause in the DATA)

@rouault rouault added a commit that referenced this issue Sep 2, 2016
@rouault rouault [OGR] Do not install spatial filter on a layer without geometry to av…
…oid a OGR error to be triggered at msOGRFileNextShape() time (typical of a SQLite/Spatialite/GPKG SQL select layer that returns zero records) (#5317)
9b8a907
@rouault rouault closed this Sep 2, 2016
@ruhri
ruhri commented Sep 5, 2016

@rouault:
Thank you very much, this solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment