[mapserver-users] Spatial queries to Mapserver
Hi all, Any one know of examples about how to call spatial queries using Postis functions from Mapserver? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Spatial queries to Mapserver
Gabriel, You need to add a layer with your query in it - you can use variable substitution etc. an example (may or may not be a good one!) : LAYER DEBUG 3 NAME buffalo GROUP Movement METADATA layer_title Buffalo layer_order 2 END CONNECTIONTYPE postgis CONNECTION host=localhost port=5432 dbname=prices PROCESSING CLOSE_CONNECTION=DEFER DATA route FROM ( SELECT s.id, s.commodity, s.shortname, s.amount, s.purpose, s.origprov, s.destprov, ST_MakeLine(s.startpoint, s.endpoint) as route, to_char(s.origindate,'DD/MM/') as date FROM ( SELECT m.id, c.commodity, sp.shortname, c.amount, r.name AS purpose, initcap(o.name) as origprov, initcap(d.name) as destprov, ST_Centroid(o.geom) as startpoint, ST_Centroid(d.geom) as endpoint, origindate FROM movements m LEFT OUTER JOIN locations o ON m.originprovince = o.hiercode AND o.del = 0 AND o.level = 2 LEFT OUTER JOIN locations d ON m.destinationprovince = d.hiercode AND d.del = 0 AND d.level = 2 JOIN commodities c ON m.id = c.movementid AND c.del = 0 AND c.commodity = 2 LEFT OUTER JOIN species sp ON c.commodity = sp.id AND sp.del = 0 LEFT OUTER JOIN reasons r ON c.purpose::int = r.id AND r.del = 0 WHERE m.del = 0 AND originprovince is not null AND originprovince not like '0' AND destinationprovince is not null AND destinationprovince not like '0' ) AS s WHERE s.origindate '%start%' AND s.origindate '%end%' ORDER BY s.origindate ) AS foo USING UNIQUE id USING srid=4326 TYPE LINE STATUS ON HEADER 'templates/trade_header.html' FOOTER 'templates/trade_footer.html' CLASSITEM commodity CLASS NAME Buffalo EXPRESSION 2 STYLE SYMBOL arrow1 OFFSET 0 0 SIZE 12 COLOR 0 0 255 END TEMPLATE 'templates/trade_query.html' END END Actually, I don't think it's a great example, but it shows you how to create a line on the fly using the centroid (probably should have been point on surface) showing the direction the animals moved, within a user specified time frame. I'm open to any feedback on this - it's a modification of one I modified from one Regina Obe posted somewhere. I should say, note the use of debug. the error messages are invaluable when it doesn't work. good luck cheers Ben On 26/06/2009, at 2:47 PM, mapserver-users-requ...@lists.osgeo.org wrote: Subject: [mapserver-users] Spatial queries to Mapserver Hi all, Any one know of examples about how to call spatial queries using Postis functions from Mapserver? -- Ben Madin REMOTE INFORMATION t : +61 8 9192 5455 f : +61 8 9192 5535 m : 0448 887 220 Broome WA 6725 b...@remoteinformation.com.au Out here, it pays to know... ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] geotransform
Thanks, ANNOTATION layer is really doing the job. Charlotte PS : thanks to Thomas Bonfort to for his help Steve Lime a écrit : You can also use an ANNOTATION layer to do something like this. Depends if you need a true centroid or not. Annotation layers use label points generated from an algorithm that starts with a center of gravity computation. Subsequent tweaks are made if the point is too close to the edge. That approach guarantees the point will be in the polygon unlike with a centroid. Steve On 6/25/2009 at 11:29 AM, in message 4a43a5f6.8020...@alkante.com, Charlotte Declercq c.decle...@alkante.com wrote: Actually, there are two ways of drawing polygons as points (positioned in their centroids) : either geotransform or apply the STYLE with TYPE [centroid] as described in http://mapserver.org/development/rfc/ms-rfc-45.html What is your advice ? Which one of these developments will be available the sooner? We are quite in the hurry. If I can't do this with mapserver I'll have to create a new shape with the centroids :(. Regards, -- Charlotte DECLERCQ ALKANTE SAS Ingénieur RD SIG 1, rue du Chêne Morand 35 510 Cesson-Sévigné Bur: + 33 (0) 2 99 22 25 70 fax : + 33 (0) 2 99 32 12 76 Thomas Bonfort a écrit : Most of it is already in 5.4, except for centroids :( I can push those in for 5.4.2 if you're in a hurry, otherwise you'll have to wait for 5.6/6.0 regards, thomas www.camptocamp.com http://www.camptocamp.com +33 4 79 26 57 97 On Thu, Jun 25, 2009 at 17:04, Charlotte Declercq c.decle...@alkante.com mailto:c.decle...@alkante.com wrote: Hello, Do someone know when this is going to be in a stable mapserver version? http://mapserver.org/development/rfc/ms-rfc-48.html I need to represent polygons as points in their centroids. Thanks, -- Charlotte DECLERCQ ALKANTE SAS Ingénieur RD SIG 1, rue du Chęne Morand 35 510 Cesson-Sévigné Bur: + 33 (0) 2 99 22 25 70 fax : + 33 (0) 2 99 32 12 76 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Charlotte DECLERCQ ALKANTE SAS Ingénieur RD SIG 1, rue du Chêne Morand 35 510 Cesson-Sévigné Bur: + 33 (0) 2 99 22 25 70 fax : + 33 (0) 2 99 32 12 76 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] What has changed between 5.2.X and 5.4.X?
I am sure a lot has changed, but I do experience some weird and not welcome changes in rendered images for which there is no explanation in the documentation. For my application of Cartoweb 3.5 I am using a mapfile with the following: OUTPUTFORMAT NAME 'AGG_Q' DRIVER AGG/PNG FORMATOPTION QUANTIZE_FORCE=ON FORMATOPTION QUANTIZE_DITHER=ON FORMATOPTION QUANTIZE_COLORS=256 END The resulting images were small, aesthethically pleasant and color consistent with MS 5.2.1. version. With MS 5.4.X the images are even smaller (-20%), yet the colors vary from one image produced to the other. Even with the same extent and scale the colors change significantly for each consecutive map rendered. The colors may differ from what is set as a symbol color in the mapfile. Some symbols (e.g. circle) may loose their outline at certain scales (when using SYMBOLSCALEDENOM, MAXSIZE and MINSIZE). Both MS 5.2.X and 5.4.X were compiled with identical options and the mapfile is the same one. Many thanks for any clues or explanations in advance. BR frequens ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] PHP/Mapscript CLASS TEXT
Hello I have an annotation layer on which I want to be able to draw labels. Here is the layer : LAYER CLASSITEM Id_BDCarto CONNECTION Limites_administratives/Departement.TAB CONNECTIONTYPE OGR LABELITEM Nom_Département LABELMAXSCALEDENOM 1e+07 LABELMINSCALEDENOM 1990 METADATA LAYER_TITLEdepartement GI_ARBO_ORDRE1 TYPE_SYMBOPROPORTIONAL ECHELLE_LEGENDEON CLASS_LEGENDEON END NAME layer2 STATUS ON SYMBOLSCALEDENOM 312411 TYPE ANNOTATION UNITS METERS CLASS NAME departement LABEL ANGLE 0.00 ANTIALIAS TRUE FONT Arial MAXSIZE 256 MINSIZE 4 SIZE 8 TYPE TRUETYPE BUFFER 0 COLOR 0 0 0 FORCE FALSE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 1 1 PARTIALS TRUE POSITION CC SHADOWCOLOR 0 0 0 SHADOWSIZE 0 0 END STYLE ANGLE 360 COLOR 232 246 9 OPACITY 100 SIZE [Id_BDCarto] SYMBOL Carre END TEXT END END With TEXT = , the layer is drawn without the labels. If TEXT property is present, I am unable to draw the labels, because I can't remove the TEXT property and I can't find a way to write TEXT [attribute_name] with mapscript (do the binding as for example $oStyle-setbinding(MS_STYLE_BINDING_SIZE, FIELD_NAME)). Anyone has solution : - to remove the TEXT property ? - to set the TEXT property with the attribute ? Thanks, -- Charlotte DECLERCQ ALKANTE SAS Ingénieur RD SIG 1, rue du Chêne Morand 35 510 Cesson-Sévigné Bur: + 33 (0) 2 99 22 25 70 fax : + 33 (0) 2 99 32 12 76 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] getfeatureinfo problems
Dear list, yesterday I reported problems with my WFS server. I could not fix that up till now. I have another possibly related problem. My WMS is set up allright, getcapabilities is ok, I can see the map, pan zoom, etc, no problems. When I do an Identify (GetFeatureInfo request), I get back an exception-report, with no items in (so essentially an ampty exception report). The query just doesn't seem to find the data. Clicking inside a feature and outside does differ (outside doesn't give an exception report). I've enabled debugging and this is the output when I do a GetFeatureInfo request: [Fri Jun 26 13:21:11 2009].498623 CGI Request 1 on process 1525 [Fri Jun 26 13:21:11 2009].518710 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].518735 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].523422 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].523453 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].523466 msPOSTGISLayerWhichShapes called [Fri Jun 26 13:21:11 2009].523490 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].523796 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) [Fri Jun 26 13:21:11 2009].535912 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].535925 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].535931 msPOSTGISLayerClose -- closing query_result [Fri Jun 26 13:21:11 2009].536007 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].536017 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].538905 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].538914 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].543298 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].543314 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].543319 in msPOSTGISLayerGetItems (find column names) [Fri Jun 26 13:21:11 2009].543329 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545217 msPOSTGISLayerInitItemInfo called [Fri Jun 26 13:21:11 2009].545230 msPOSTGISLayerGetShape called for record = 0 [Fri Jun 26 13:21:11 2009].545239 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545253 msPOSTGISLayerGetShape: DECLARE mycursor2 BINARY CURSOR FOR SELECT geoidn::text,idealisatie::text,tc_multi_geometry::text,tc_lijn_geometry::text,tc_punt_geometry::text,asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR') from NL.IMRO.0026.SVBBU-0001 WHERE geoidn = 0 [Fri Jun 26 13:21:11 2009].547105 msFreeMap(): freeing map at 0x943d518. [Fri Jun 26 13:21:11 2009].547114 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].547119 msPOSTGISLayerClose -- query_result is NULL [Fri Jun 26 13:21:11 2009].547124 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) Just as with the WFS problem, there is no data returning. The WFS does show the exposed columns, never any data in. I've not a clue of how to proceed, or how to get extra debug info. Please help ! MArco [Fri Jun 26 13:21:11 2009].547132 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Spatial queries to Mapserver
Thanks, I´ll digest it :-) 2009/6/26 Ben Madin b...@remoteinformation.com.au Gabriel, You need to add a layer with your query in it - you can use variable substitution etc. an example (may or may not be a good one!) : LAYER DEBUG 3 NAME buffalo GROUP Movement METADATA layer_title Buffalo layer_order 2 END CONNECTIONTYPE postgis CONNECTION host=localhost port=5432 dbname=prices PROCESSING CLOSE_CONNECTION=DEFER DATA route FROM ( SELECT s.id, s.commodity, s.shortname, s.amount, s.purpose, s.origprov, s.destprov, ST_MakeLine(s.startpoint, s.endpoint) as route, to_char(s.origindate,'DD/MM/') as date FROM ( SELECT m.id, c.commodity, sp.shortname, c.amount, r.name AS purpose, initcap(o.name) as origprov, initcap(d.name) as destprov, ST_Centroid(o.geom) as startpoint, ST_Centroid(d.geom) as endpoint, origindate FROM movements m LEFT OUTER JOIN locations o ON m.originprovince = o.hiercode AND o.del = 0 AND o.level = 2 LEFT OUTER JOIN locations d ON m.destinationprovince = d.hiercode AND d.del = 0 AND d.level = 2 JOIN commodities c ON m.id = c.movementid AND c.del = 0 AND c.commodity = 2 LEFT OUTER JOIN species sp ON c.commodity = sp.id AND sp.del = 0 LEFT OUTER JOIN reasons r ON c.purpose::int = r.id AND r.del = 0 WHERE m.del = 0 AND originprovince is not null AND originprovince not like '0' AND destinationprovince is not null AND destinationprovince not like '0' ) AS s WHERE s.origindate '%start%' AND s.origindate '%end%' ORDER BY s.origindate ) AS foo USING UNIQUE id USING srid=4326 TYPE LINE STATUS ON HEADER 'templates/trade_header.html' FOOTER 'templates/trade_footer.html' CLASSITEM commodity CLASS NAME Buffalo EXPRESSION 2 STYLE SYMBOL arrow1 OFFSET 0 0 SIZE 12 COLOR 0 0 255 END TEMPLATE 'templates/trade_query.html' END END Actually, I don't think it's a great example, but it shows you how to create a line on the fly using the centroid (probably should have been point on surface) showing the direction the animals moved, within a user specified time frame. I'm open to any feedback on this - it's a modification of one I modified from one Regina Obe posted somewhere. I should say, note the use of debug. the error messages are invaluable when it doesn't work. good luck cheers Ben On 26/06/2009, at 2:47 PM, mapserver-users-requ...@lists.osgeo.org wrote: *Subject: **[mapserver-users] Spatial queries to Mapserver* Hi all, Any one know of examples about how to call spatial queries using Postis functions from Mapserver? -- Ben Madin REMOTE INFORMATION t : +61 8 9192 5455 f : +61 8 9192 5535 m : 0448 887 220 Broome WA 6725 b...@remoteinformation.com.au Out here, it pays to know... ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getfeatureinfo problems
Hi, Have you tried to run the SQL queries from logfile directly? I wonder if for example this part is correct and finds any data: WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) Just a guess, but perhaps odd table name makes some trouble. How about reneming or copying the table temporarily to something wiht more simple name, like test? -Jukka Rahkonen- DeDuikertjes wrote: Dear list, yesterday I reported problems with my WFS server. I could not fix that up till now. I have another possibly related problem. My WMS is set up allright, getcapabilities is ok, I can see the map, pan zoom, etc, no problems. When I do an Identify (GetFeatureInfo request), I get back an exception-report, with no items in (so essentially an ampty exception report). The query just doesn't seem to find the data. Clicking inside a feature and outside does differ (outside doesn't give an exception report). I've enabled debugging and this is the output when I do a GetFeatureInfo request: [Fri Jun 26 13:21:11 2009].498623 CGI Request 1 on process 1525 [Fri Jun 26 13:21:11 2009].518710 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].518735 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].523422 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].523453 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].523466 msPOSTGISLayerWhichShapes called [Fri Jun 26 13:21:11 2009].523490 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].523796 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) [Fri Jun 26 13:21:11 2009].535912 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].535925 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].535931 msPOSTGISLayerClose -- closing query_result [Fri Jun 26 13:21:11 2009].536007 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].536017 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].538905 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].538914 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].543298 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].543314 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].543319 in msPOSTGISLayerGetItems (find column names) [Fri Jun 26 13:21:11 2009].543329 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545217 msPOSTGISLayerInitItemInfo called [Fri Jun 26 13:21:11 2009].545230 msPOSTGISLayerGetShape called for record = 0 [Fri Jun 26 13:21:11 2009].545239 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545253 msPOSTGISLayerGetShape: DECLARE mycursor2 BINARY CURSOR FOR SELECT geoidn::text,idealisatie::text,tc_multi_geometry::text,tc_lijn_geometry::text,tc_punt_geometry::text,asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR') from NL.IMRO.0026.SVBBU-0001 WHERE geoidn = 0 [Fri Jun 26 13:21:11 2009].547105 msFreeMap(): freeing map at 0x943d518. [Fri Jun 26 13:21:11 2009].547114 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].547119 msPOSTGISLayerClose -- query_result is NULL [Fri Jun 26 13:21:11 2009].547124 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) Just as with the WFS problem, there is no data returning. The WFS does show the exposed columns, never any data in. I've not a clue of how to proceed, or how to get extra debug info. Please help ! MArco [Fri Jun 26 13:21:11 2009].547132 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38)
[mapserver-users] classification of a raster image is changing
Hello list, I have the following problem with UMNMapserver 5.2: I have interpolated some data with gdal_grid. As the result I got a tiff file with one band. In the next step i classified the raster image in UMN Mapserver like this: (..) CLASS NAME = 12 h EXPRESSION ([pixel] 9 AND [pixel] = 12) STYLE COLOR 65 182 196 END END (..) so far so good But if i view the image in a client like QGIS, the classification (colors) is changing depending on the chosen section (see appendix). What is my mistake? Thanks for helping! Regards Stefan ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getfeatureinfo problems
Jukka, Thank you, I've tried the SQL statement: DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) with the first DECLARE part omitted, so: SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) This returns two rows. I've tried SELECT geoidn::text,idealisatie::text,tc_multi_geometry::text,tc_lijn_geometry::text,tc_punt_geometry::text,asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR') from NL.IMRO.0026.SVBBU-0001 WHERE geoidn = 0 also, which returns 0 rows. This is as expected from this query as it asks for WHERE geoidn = 0 geoidn never is 0. Why does mapserver come to this query? I've never asked for geidn to be zero! If I remove the WHERE geoidn = 0 I get a result for all the layers on the point (all the layers in fact). Somehow this WHERE geoidn = 0 condition is constructed false. Ist should be something like WHERE geoidn = geoidNL.IMRO.0026.SVBBU-0001 I've not a clue where that wrong query clause comes from. MArco P.S. In earlier attempts I've renamed the tables with identical results. Rahkonen Jukka schreef: Hi, Have you tried to run the SQL queries from logfile directly? I wonder if for example this part is correct and finds any data: WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) Just a guess, but perhaps odd table name makes some trouble. How about reneming or copying the table temporarily to something wiht more simple name, like test? -Jukka Rahkonen- DeDuikertjes wrote: Dear list, yesterday I reported problems with my WFS server. I could not fix that up till now. I have another possibly related problem. My WMS is set up allright, getcapabilities is ok, I can see the map, pan zoom, etc, no problems. When I do an Identify (GetFeatureInfo request), I get back an exception-report, with no items in (so essentially an ampty exception report). The query just doesn't seem to find the data. Clicking inside a feature and outside does differ (outside doesn't give an exception report). I've enabled debugging and this is the output when I do a GetFeatureInfo request: [Fri Jun 26 13:21:11 2009].498623 CGI Request 1 on process 1525 [Fri Jun 26 13:21:11 2009].518710 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].518735 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].523422 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].523453 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].523466 msPOSTGISLayerWhichShapes called [Fri Jun 26 13:21:11 2009].523490 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].523796 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) [Fri Jun 26 13:21:11 2009].535912 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].535925 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].535931 msPOSTGISLayerClose -- closing query_result [Fri Jun 26 13:21:11 2009].536007 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].536017 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].538905 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].538914 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].543298 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].543314 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].543319 in msPOSTGISLayerGetItems (find column names) [Fri Jun 26 13:21:11 2009].543329 msPOSTGISLayerParseData:
Re: [mapserver-users] getfeatureinfo problems
Hi, Mapserver needs an integer type column for the USING UNIQUE clause, not a string column. That won't work. Best regards, Bart DeDuikertjes wrote: Jukka, Thank you, I've tried the SQL statement: DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) with the first DECLARE part omitted, so: SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) This returns two rows. I've tried SELECT geoidn::text,idealisatie::text,tc_multi_geometry::text,tc_lijn_geometry::text,tc_punt_geometry::text,asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR') from NL.IMRO.0026.SVBBU-0001 WHERE geoidn = 0 also, which returns 0 rows. This is as expected from this query as it asks for WHERE geoidn = 0 geoidn never is 0. Why does mapserver come to this query? I've never asked for geidn to be zero! If I remove the WHERE geoidn = 0 I get a result for all the layers on the point (all the layers in fact). Somehow this WHERE geoidn = 0 condition is constructed false. Ist should be something like WHERE geoidn = geoidNL.IMRO.0026.SVBBU-0001 I've not a clue where that wrong query clause comes from. MArco P.S. In earlier attempts I've renamed the tables with identical results. Rahkonen Jukka schreef: Hi, Have you tried to run the SQL queries from logfile directly? I wonder if for example this part is correct and finds any data: WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) Just a guess, but perhaps odd table name makes some trouble. How about reneming or copying the table temporarily to something wiht more simple name, like test? -Jukka Rahkonen- DeDuikertjes wrote: Dear list, yesterday I reported problems with my WFS server. I could not fix that up till now. I have another possibly related problem. My WMS is set up allright, getcapabilities is ok, I can see the map, pan zoom, etc, no problems. When I do an Identify (GetFeatureInfo request), I get back an exception-report, with no items in (so essentially an ampty exception report). The query just doesn't seem to find the data. Clicking inside a feature and outside does differ (outside doesn't give an exception report). I've enabled debugging and this is the output when I do a GetFeatureInfo request: [Fri Jun 26 13:21:11 2009].498623 CGI Request 1 on process 1525 [Fri Jun 26 13:21:11 2009].518710 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].518735 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].523422 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].523453 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].523466 msPOSTGISLayerWhichShapes called [Fri Jun 26 13:21:11 2009].523490 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].523796 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) [Fri Jun 26 13:21:11 2009].535912 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].535925 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].535931 msPOSTGISLayerClose -- closing query_result [Fri Jun 26 13:21:11 2009].536007 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].536017 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].538905 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].538914 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].543298 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].543314
Re: [mapserver-users] javascript query template examples
Responses inline... On 6/25/2009 at 4:59 PM, in message 20090625215916.ga11...@q.rho.net, Wendell Turner wend...@enflight.com wrote: On Thu, Jun 25, 2009 at 03:13:21PM -0500, Steve Lime wrote: Here's one example using new-style templating (recommend MapServer 5.4.1). I'm using 5.2.0. Do I need to upgrade? Well, I'd recommend 5.2.2 at a minimum simply because of the security upgrades made in the last few months. 5.4.1 is the latest version and contains a few fixes that fix templates that have multiple [item ...] or [shpxy ...] tags on a single line. Anyway, please ask questions if you need to. Ok! The TEMPLATE: // MapServer Template function updateCountyList(element) { var option; ... } So, where does this template go? Good question, I guess that wasn't clear in my response. In this case the template is separate file and is referenced in the OUTPUTFORMAT itself via the FORMATOPTION/FILE option. In this example the actual template is the file /templates/demo_county_select_list.js. 1) there is a TEMPLATE in the WEB section. It seems that if that line is present, it gets used. I don't think it is that template. Correct, the web template is for defining a browse interface and really isn't used all that much anymore. 2) There is DRIVER 'TEMPLATE' in the OUTPUTFORMAT section. Should the above code be in a file named TEMPLATE? 3) There is a file in the FORMATOPTION under a /templates/ directory that looks suspicious. Bingo... 4) There is a TEMPLATE in the LAYER section that is used to indicate that the layer is queryable, and how to format that layer's data. The TEMPLATE keyword is still used to make layers queryable. That may change in the future. Simple using something like TEMPLATE 'dummy' will suffice. The OUTPUTFORMAT: OUTPUTFORMAT NAME 'county_select_list' DRIVER 'TEMPLATE' MIMETYPE 'text/javascript' FORMATOPTION 'ATTACHMENT=county_select_list.js' FORMATOPTION 'FILE=/templates/demo_county_select_list.js' END What is the difference in ATTACHMENT and FILE? FILE is the actual template. ATTACHMENT sets a HTTP header that essentially names the response from MapServer. In this case the browser would save the file as county_select_list.js. I'm pretty sure this is only available in 5.4 but isn't required at all. The call to the CGI to run it is: script src=http://maps.dnr.state.mn.us/cgi-bin/mapserv54?map=demo.mapqlayer=count iesqformat=county_select_listmode=nquery/script Aha! qformat=name_of_the_output_format Yup. You now can have a bunch of output formats without having to have a bunch of layers for each one. A layer's features can be referenced by any number of templates! Thanks, Wendell ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS returning empty features
List, Thanks to Bart van den Eijnden the problem is solved. I used a using unique clause on a column which was unique, but not integer. So I now create my postgis tables with a CREAT TABLE WITH OIDS and I use a using unique oid clause in the DATA statement. As often, details do matter. Thanks for all the responses and efforts. MArco ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getfeatureinfo problems
List, Thanks to Bart van den Eijnden the problem is solved. I used a using unique clause on a column which was unique, but not integer. So I now create my postgis tables with a CREAT TABLE WITH OIDS and I use a using unique oid clause in the DATA statement. As often, details do matter. Thanks for all the responses and efforts. MArco DeDuikertjes wrote: Dear list, yesterday I reported problems with my WFS server. I could not fix that up till now. I have another possibly related problem. My WMS is set up allright, getcapabilities is ok, I can see the map, pan zoom, etc, no problems. When I do an Identify (GetFeatureInfo request), I get back an exception-report, with no items in (so essentially an ampty exception report). The query just doesn't seem to find the data. Clicking inside a feature and outside does differ (outside doesn't give an exception report). I've enabled debugging and this is the output when I do a GetFeatureInfo request: [Fri Jun 26 13:21:11 2009].498623 CGI Request 1 on process 1525 [Fri Jun 26 13:21:11 2009].518710 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].518735 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].523422 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].523453 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].523466 msPOSTGISLayerWhichShapes called [Fri Jun 26 13:21:11 2009].523490 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].523796 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001 WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(155984.407968748 468982.233317728,156024.590926508 469022.416275488)'::BOX3D,28992) ) [Fri Jun 26 13:21:11 2009].535912 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].535925 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].535931 msPOSTGISLayerClose -- closing query_result [Fri Jun 26 13:21:11 2009].536007 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].536017 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].538905 msPOSTGISLayerOpen called datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].538914 MSPOSTGISLayerOpen -- shared connection not available. [Fri Jun 26 13:21:11 2009].543298 msConnPoolRegister(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) [Fri Jun 26 13:21:11 2009].543314 msPOSTGISLayerFreeItemInfo called [Fri Jun 26 13:21:11 2009].543319 in msPOSTGISLayerGetItems (find column names) [Fri Jun 26 13:21:11 2009].543329 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545217 msPOSTGISLayerInitItemInfo called [Fri Jun 26 13:21:11 2009].545230 msPOSTGISLayerGetShape called for record = 0 [Fri Jun 26 13:21:11 2009].545239 msPOSTGISLayerParseData: unique column = geoidn, srid='28992', geom_column_name = tc_vlak_geometry, table_name=NL.IMRO.0026.SVBBU-0001 [Fri Jun 26 13:21:11 2009].545253 msPOSTGISLayerGetShape: DECLARE mycursor2 BINARY CURSOR FOR SELECT geoidn::text,idealisatie::text,tc_multi_geometry::text,tc_lijn_geometry::text,tc_punt_geometry::text,asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR') from NL.IMRO.0026.SVBBU-0001 WHERE geoidn = 0 [Fri Jun 26 13:21:11 2009].547105 msFreeMap(): freeing map at 0x943d518. [Fri Jun 26 13:21:11 2009].547114 msPOSTGISLayerClose datastatement: tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992 [Fri Jun 26 13:21:11 2009].547119 msPOSTGISLayerClose -- query_result is NULL [Fri Jun 26 13:21:11 2009].547124 msConnPoolRelease(geoidNL.IMRO.0026.SVBBU-0001_vlak,host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) Just as with the WFS problem, there is no data returning. The WFS does show the exposed columns, never any data in. I've not a clue of how to proceed, or how to get extra debug info. Please help ! MArco [Fri Jun 26 13:21:11 2009].547132 msConnPoolClose(host=localhost user=tc_check dbname=80.101.100.35,0x9457b38) ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] PHP/Mapscript CLASS TEXT
Charlotte Declercq wrote: With TEXT = , the layer is drawn without the labels. If TEXT property is present, I am unable to draw the labels, because I can't remove the TEXT property and I can't find a way to write TEXT [attribute_name] with mapscript (do the binding as for example $oStyle-setbinding(MS_STYLE_BINDING_SIZE, FIELD_NAME)). Anyone has solution : - to remove the TEXT property ? I don't think there is a way to remove the text property with the current version. Could you please file a ticket and we'll try to fix that in the next release? It will likely be done by calling $class-setText(null) - to set the TEXT property with the attribute ? The following should work: $class-setText(([FIELD_NAME])); Okay, I'll admit that was not obvious. The TEXT parameter works differently from regular attribute binding. It actually goes through the logical expression parser, that's why there is a special setTExt() method and the round brackets are required. Daniel -- Daniel Morissette http://www.mapgears.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getfeatureinfo problems
On 26/6/09 11:10 PM, Bart van den Eijnden (OSGIS) wrote: Mapserver needs an integer type column for the USING UNIQUE clause, not a string column. That won't work. Actually, no it doesn't require an integer type column for the UNIQUE clause. I have used text fields in the past with mapserver 5.x and can confirm that it does indeed work. Mind you, some other cartographic software such as QGIS does insist on int4 fields for PostGIS layers, but not mapserver. Regards, David ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users