I'm doing a spatial query, but I always get an error:
"msPOSTGISLayerGetShape(): Query error. msPOSTGISLayerGetShape called on unopened layer (layerinfo = NULL)"
This is my code:
layerObj layerUtbs = Util.MSMap.getLayerByName("Utbs");
if (layerUtbs.queryByRect(Util.MSMap, rect) == (int)MS_RETURN_VALUE.MS_SUCCESS)
{
resultCacheObj resultado = layerUtbs.getResults();
if (resultado.numresults > 0)
{
// here i got a error.
layerUtbs.getFeature(resultado.getResult(0).shapeindex, resultado.getResult(0).tileindex);
}
}
Here's my map file configuration
LAYER
CONNECTIONTYPE postgis
NAME "Utbs"
CONNECTION "user=pmc dbname=SiteInovacao host=localhost password=123 port=5432"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geom from (SELECT *, oid FROM pmc.utbs) as utbs using unique oid using srid=31983"