[mapserver-users] Layer Query

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Mon Oct 29 12:55:17 PDT 2012


Your syntax looks off. Below a snippet (in Perl) from RFC 65 (http://www.mapserver.org/development/rfc/ms-rfc-65.html). It applies generally to all languages.

my $rect = new mapscript::rectObj(420000, 5120000, 582000, 5200000);
$layer->queryByRect($map, $rect); # layer is left open after this operation

for(my $i=0; $i<$layer->getNumResults(); $i++) {
       my $shape = $layer->getShape($layer->getResult($i));
       ...
}

Steve

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Gaston Lucero
Sent: Monday, October 29, 2012 2:40 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Layer Query

Hello, I am researching and trying to use queries layers of mapserver, mapscript through, but not how to obtain, if possible, the result information.
I do not use wms

My java code

mapObj map = new mapObj("/home/gaston/maps/map/map.map")    ;
layerObj layer = map.getLayerByName("Info");
//centerP es el putno
layer.queryByPoint(map,new pointObj(centerP.getX(),centerP.getY(),0), mapscriptConstants.MS_SINGLE, 10);
layer.open();
resultCacheObj res =layer.getResults();
            for(int i=0 ;i<layer.getNumResults();i++){ /
                shapeObj feature = layer.getShape(res.getResult(i));
               //Aca no se q hacer
            }


My .map

MAP
STATUS on
SIZE 256 256
EXTENT -20037508 -20037508 20037508 20037508
UNITS meters
IMAGETYPE agg #Este nombre debe coincidir con el valor NAME de OUTPUTFORMAT
SHAPEPATH "data"
FONTSET "font/fonts.fnt"
SYMBOLSET "symbol/symbols.sym"
IMAGECOLOR "#b3c6d4"
DEBUG 5
CONFIG  "MS_ERRORFILE" "/tmp/mapseerver.log"

OUTPUTFORMAT
NAME agg
DRIVER agg/png
IMAGEMODE rgb
FORMATOPTION "PALETTE_FORCE=TRUE" #es incompatible con la opcion anterior
FORMATOPTION "PALETTE=/home/gaston/maps/map/palette/map.palette"
MIMETYPE "image/png"
END
PROJECTION
"init=epsg:900913"
END
LAYER
NAME Info
STATUS on
TYPE polygon
CONNECTIONTYPE postgis
        CONNECTION "####"
DATA "polygon from gis.pois"
CLASS
STYLE
COLOR "#f2efe9"
OUTLINECOLOR "#f2efe9"
END
END
PROCESSING "CLOSE_CONNECTION=DEFER"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20121029/02528963/attachment-0001.html>


More information about the mapserver-users mailing list