Skip to content
Permalink
Browse files
msOGRFileWhichShapes(): fix case where there is no items
  • Loading branch information
rouault committed Jul 1, 2016
1 parent 16d841f commit b007fdb06871dc95e5b2577c0bd83d16b31459bd
Showing 1 changed file with 2 additions and 2 deletions.
@@ -1676,8 +1676,8 @@ static int msOGRFileWhichShapes(layerObj *layer, rectObj rect, msOGRFileInfo *ps
select = msStringConcatenate(select, layer->items[i]);
select = msStringConcatenate(select, "\"");
}

select = msStringConcatenate(select, ", ");
if( layer->numitems > 0 )
select = msStringConcatenate(select, ", ");
pszGeometryColumn = OGR_L_GetGeometryColumn(psInfo->hLayer);
if( pszGeometryColumn != NULL && pszGeometryColumn[0] != '\0' ) {
select = msStringConcatenate(select, "\"");

6 comments on commit b007fdb

@ruhri
Copy link

@ruhri ruhri commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rouault
Hello Even,
maybe I'm wrong here, but I have an error using the latest master (01.09.2016) and I think it belongs to the topic of this commit:
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.

This doesn't happen with datasource postgis - mapserver just returns blank image which is fine.
Should I report an issue for that?

@rouault
Copy link
Contributor Author

@rouault rouault commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is related this is related to having no features, but it would look like if the table was non spatial. If you open a ticket, please provide a minimum mapfile to reproduce, a test database and the exact request sent.

@ruhri
Copy link

@ruhri ruhri commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure, the table is spatial.

table

Changing my filters (on the same table-columns) so that I get Features, everything is OK.

Relevant part of mapfile:
DATA "SELECT * FROM poi_gp_pois_allepoisn_tb WHERE coll_idpfad LIKE '%poi_unterkuenfte_coll_idpfad%' AND bedeutung_id <= '%symbol_scaledenom%'"

VALIDATION
"poi_unterkuenfte_coll_idpfad" '^609-[0-9-]+$'
"default_poi_unterkuenfte_coll_idpfad" '609%'
END

SCALETOKEN
NAME "%symbol_scaledenom%"
VALUES
"0" '3'
"21000" '2'
"81000" '1'
END
END

other layers just have different LIKE filters, e.g. "default_poi_natur_coll_idpfad" '404%' -> works

@rouault
Copy link
Contributor Author

@rouault rouault commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think I've found the issue (a GDAL one actually). Can you open a dedicated MapServer ticket about that ? I should be able to workaround the GDAL bug (that I'm fixing anyway)

@rouault
Copy link
Contributor Author

@rouault rouault commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually correcting myself. There was indeed a similar GDAL issue, but this is not what is triggered here. I'm filing myself the ticket as I've the fix ready

@rouault
Copy link
Contributor Author

@rouault rouault commented on b007fdb Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5317

Please sign in to comment.