[mapserver-dev] OGR single-pass query issues (was Ready for 5.6.2)

Tamas Szekeres szekerest at gmail.com
Wed Mar 17 19:55:43 EDT 2010


2010/3/17 Frank Warmerdam <warmerdam at pobox.com>

>
> I wrote a small test script (msautotest/mspython/ogr_query.py) and I
> did not observe any problems with resultsGetShape() and queryByRect().
> What problem were you expecting?
>
>
Frank,

I've looked into the problem in a bit more detail and it seems I have the
problem with the following test case.

1. Use queryByRect in a layer to retrieve some shapes into the result set.
2. Use drawQuery (MS_HILITE) in a larger area (covering a larger set of the
features from the layer) and notice that different features are highlighed
not the features matching with the previous query.


Actually we use the following code in msDrawQueryLayer to draw the
background before the selected features are drawn:

if(map->querymap.style == MS_NORMAL || map->querymap.style == MS_HILITE) {
    layerObj tmp_layer;

    if(initLayer(&tmp_layer, map) == -1)
        return(MS_FAILURE);

    if (msCopyLayer(&tmp_layer, layer) != MS_SUCCESS)
        return(MS_FAILURE);

    status = msDrawLayer(map, &tmp_layer, image);

    freeLayer(&tmp_layer);

    if(map->querymap.style == MS_NORMAL || status != MS_SUCCESS)
return(status);
  }


It appears that however we use a different layer instance for the drawing,
we reuse the previous connection and the same OGR layer reference is used
for drawing the background features and then the query results. In this
regard, drawing the the background will cause the feature indexes in the
result set go out of sync with the underlying layer.

Best regards,

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20100318/a1c4fdae/attachment.html


More information about the mapserver-dev mailing list