[Geomoose-users] select and query in postgis layers
Bistrais, Bob
Bob.Bistrais at maine.gov
Tue Feb 19 11:33:28 PST 2013
I have found a partial fix to the problem. I still cannot get my file GDB layer to highlight the selected shapes, but I can get a correct result for the Found Shapes line, and the results are also inserted to the SQLite file so you can output to csv or report.
Here's what I did: Make a backup copy of select.php. Then, in select.php, look for the following line, at or about line 262:
$results = $results . $map->processquerytemplate(array(), false);
Below that line, add the following:
for($i=0; $i<=($layer->getNumResults() - 1); $i++){
$result=$layer->getResult($i);
$myShape=$layer->getShape($result);
$foundShapes[] = $myShape;
}
-save and try that.
One thing I have not checked- if you use the same code on shapefiles, you may get duplicate results or Found Shapes may be twice what you expected, since the result shapes are being added twice. I haven't checked that far yet, but I think some code that will determine the file type can help eliminate such an error.
Hope this helps, but I'd still be interested in anyone else's input.
From: geomoose-users-bounces at lists.osgeo.org [mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Luis Calisto
Sent: Tuesday, February 19, 2013 1:08 PM
To: geomoose-users at lists.osgeo.org
Subject: [Geomoose-users] select and query in postgis layers
Hi
i'm working with geomoose version 2.6.1
I have some layers in shapefile but the most part is postgis.
Everything is ok except that with the postgis layers the select and the query services do not work. The select returns well the attributes but says that "Found Shapes: 0" and does not highlight any feature. The query service return no value at all. The select and the query service is fine with the shapefile based layers and the identify service is fine with both layers.
I followed the documentation in the demo but this documentation is made for shapefiles, maybe something is missing with my config.
Anyone can help?
Thanks
My configs are the folowing:
mapbook describing the query and the select services:
<service name="buffered_select" title="Select Features">
<url>php/select.php</url>
<!-- Send a selection shape + the visible layers list to the service -->
<step type="spatial" showTools="true" name="shape" line="true" polygon="true" point="true" default="polygon" edit-polygon="false" pan="false">
<header><![CDATA[Create a selection area by clicking on the map.]]></header>
<input type="visiblelayers" name="layers"/>
<!--
Option values should be the mapbook path to the layer.
This only supports 'mapserver'-type layers.
-->
<input type="select" name="select_layer" title="Select features from:">
<option value="pontos_demo/pontos_demo">Pontos_demo</option>
<option value="pontos_shp/pontos_shp">Pontos_shp</option>
<option value="prov_shp/prov_shp">prov_shp</option>
</input>
<!--
<input type="user" name="select_buffer" title="Buffer Selected Features (m)">0</input>
-->
<input type="length" name="selection_buffer" title="Buffer Selection Shape">0</input>
<input type="select" name="query_layer" title="Using Features In">
<option value="">No Layer</option>
<option value="pontos_demo/pontos_demo">Pontos_demo</option>
<option value="pontos_shp/pontos_shp">Pontos_shp</option>
<option value="prov_shp/prov_shp">prov_shp</option>
</input>
<input type="projection" name="projection"/>
<footnote><![CDATA[
]]></footnote>
</step>
</service>
----------------------------------------------------------------------------------------------------------------------------------------------
<service name="search_parcels" title="Search">
<url>php/query.php</url>
<step type="input">
<input type="hidden" name="highlight" value="true"/>
<input type="hidden" name="mode" value="search"/>
<input type="hidden" name="layer0" value="pontos_demo/pontos_demo"/>
<input type="hidden" name="template0" value="itemquery"/>
<input type="select" name="fieldname0" title="Search By:">
<option value="gid">ID</option>
</input>
<input type="select" name="comparitor0" title="That: ">
<option value="like-icase">Contains</option>
<option value="right-like-icase">Begins With</option>
<option value="eq-str">Matches Exactly</option>
<option value="in">In List</option>
</input>
<input type="user" name="value0" title=""/>
<input type="hidden" name="fieldname1" value="FIN_SQ_FT"/>
<input type="select" name="operator1">
<option value="or">OR</option>
<option value="and">AND</option>
</input>
<input type="select" name="comparitor1" title="Having Fin. Sq. Ft. ">
<option value="gt">Greater Than</option>
<option value="eq">Equal To</option>
<option value="lt">Less Than</option>
</input>
<input type="user" name="value1" title=""/>
</step>
</service>
---------------------------------------------------------------------------------
map file of the postgis layer:
MAP
NAME 'pontos_demo'
SIZE 800 650
STATUS ON
EXTENT 19.069345 -27.742864 51.134315 -9.525530
UNITS METERS
INCLUDE "../../geomoose_globals.map"
WEB
METADATA
'ows_title' 'Pontos'
'ows_srs' 'EPSG:4326 EPSG:3857'
'ows_enable_request' '*'
'ows_onlineresource' 'http://www.geomoose.org'
END
END
PROJECTION
'init=epsg:4326'
END
LEGEND
STATUS ON
LABEL
TYPE TRUETYPE
FONT vera_sans
SIZE 8
COLOR 0 0 0
END
END
LAYER
NAME 'pontos_demo'
TYPE POINT
DUMP true
EXTENT 19.069345 -27.742864 51.134315 -9.525530
CONNECTIONTYPE postgis
CONNECTION "dbname='atlas_mz' host=localhost port=5432 user='postgres' password='postgis' sslmode=disable"
DATA 'the_geom FROM "public"."pontos_sportgis" USING UNIQUE gid USING srid=4326'
LABELITEM 'tipo_infra'
LABELCACHE ON
LABELMAXSCALE 500000
CLASSITEM 'tipo'
CLASS
NAME "Estadio"
EXPRESSION "1"
STYLE
SYMBOL "circle"
SIZE 17.0
OUTLINECOLOR 0 0 0
COLOR 0 0 0
END
LABEL
FONT vera_sans
TYPE truetype
SIZE 13
COLOR 0 0 0
ANGLE 0
POSITION auto
FORCE true
ANTIALIAS true
PARTIALS true
END
END
CLASS
NAME "Campo de futebol"
EXPRESSION "2"
STYLE
SYMBOL "circle"
SIZE 12
OUTLINECOLOR 0 0 0
COLOR 255 170 0
END
LABEL
FONT vera_sans
TYPE truetype
SIZE 9
COLOR 0 0 0
ANGLE 0
POSITION auto
#FORCE true
ANTIALIAS true
PARTIALS true
END
END
CLASS
NAME "Campo de tenis"
EXPRESSION "3"
STYLE
SYMBOL "circle"
SIZE 7.0
OUTLINECOLOR 0 0 0
COLOR 255 0 0
END
LABEL
FONT vera_sans
TYPE truetype
SIZE 9
COLOR 0 0 0
ANGLE 0
POSITION auto
#FORCE true
ANTIALIAS true
PARTIALS true
END
END
METADATA
# drill-down identify service record.
'identify_record' 'templates/identify.html'
# query.php / "Search Parcels" functionality.
'itemquery' 'templates/search_result.html'
'itemquery-filter' '/.*[qstring].*/i'
'qstring_validation_pattern' '.'
# Feature reports are stored in the conf/feature_report directory.
'feature_report' 'parcel.xml'
'select_record' 'templates/select_result.html'
'select_header' 'templates/select_header.html'
'popups' 'parcels_popup.html'
END
TOLERANCE 1
TOLERANCEUNITS PIXELS
END
END ## end Map
-------------------------------
postgis table:
-------------------------------
CREATE TABLE public.pontos_sportgis
(
gid integer NOT NULL DEFAULT nextval('pontos_sportgis_gid_seq'::regclass),
the_geom geometry(MultiPoint,4326),
tipo_infra character varying(80),
fotografia character varying(80),
tipo smallint,
nome character(50),
CONSTRAINT pontos_sportgis_pkey PRIMARY KEY (gid )
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.pontos_sportgis
OWNER TO postgres;
CREATE INDEX sidx_pontos_sportgis_the_geom
ON public.pontos_sportgis
USING gist
(the_geom );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20130219/c528abe1/attachment-0001.html>
More information about the Geomoose-users
mailing list