[mapserver-users] javascript query template examples
Hi mapserver-users, Steve Lime has indeed explained bits of using javascript in CGI query templates, but I'm still lost. Are there any examples showing how to use javascript in a query template to do things like, for example, format the returned query result list to remove duplicate records? Thanks, Greg. Greg Luker GIS Lab Manager, Southern Cross University Lismore, AUSTRALIA. glu...@scu.edu.au phone 61 2 66203026 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] WFS returning empty features
I compared your not working mapfile with one i'm using that is working. Some suggestions: - add in you map/web/metadata a wfs_extent - add a EXTENT to your layer Roy _ From: DeDuikertjes [mailto:deduikert...@xs4all.nl] To: mapserver-users@lists.osgeo.org Sent: Wed, 24 Jun 2009 16:29:24 +0200 Subject: Re: [mapserver-users] WFS returning empty features List, To help on debugging I've forced an error in the postgis connection te see the actual query. This is: 'DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(tc_vlak_geometry)),'NDR'),geoidn::text from NL.IMRO.0026.SVBBU-0001x WHERE (geoidn='geoidNL.IMRO.0026.SVBBU-0001') and (tc_vlak_geometry setSRID( 'BOX3D(140016 460631,166758 490080)'::BOX3D,28992) )' I've also got rid off all destracting details so I've ended up with the mapfile on the end of this message. MArco MAP NAME NL.IMRO.0026.SVBBU-0001 IMAGETYPE png UNITS METERS EXTENT 140016 460631 166758 490080 PROJECTION init=epsg:28992 END WEB METADATA ows_title NL.IMRO.0026.SVBBU-0001 wms_onlineresource http://tercera-go.tercera-ro.nl/cgi-bin/mapserv?map=../html/plancheck_test/data/80.101.100.35_check/NL.IMRO.0026.SVBBU-0001/wkt/NL.IMRO.0026.SVBBU-0001-test.map; wfs_onlineresource http://tercera-go.tercera-ro.nl/cgi-bin/mapserv?map=../html/plancheck_test/data/80.101.100.35_check/NL.IMRO.0026.SVBBU-0001/wkt/NL.IMRO.0026.SVBBU-0001-test.map; wfs_srs EPSG:28992 wms_srs EPSG:28992 END END LAYER name geoidNL.IMRO.0026.SVBBU-0001_vlak PROJECTION init=epsg:28992 END METADATA ows_title geoidNL.IMRO.0026.SVBBU-0001_vlak gml_include_items geoidn,idealisatie #gml_featureid geoidn wfs_featureidgeoidn wfs_extent140016 460631 166758 490080 END STATUS on TYPE polygon DUMP true CONNECTIONTYPE postgis CONNECTION host=localhost user=tc_check dbname=80.101.100.35 DATA 'tc_vlak_geometry from NL.IMRO.0026.SVBBU-0001 using unique geoidn using srid=28992' FILTER geoidn='geoidNL.IMRO.0026.SVBBU-0001' TEMPLATE dummy.html CLASS STYLE COLOR 0 0 0 OUTLINECOLOR 255 0 0 END END END END ___ 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] need help with query
On Wed, Jun 24, 2009 at 11:48:14PM -0500, Steve Lime wrote: I'll start with the obvious questions: 1) are the layers queryable (e.g. is a TEMPLATE set?) Umm..., it wasn't obvious to me. That was it. I had a template for the map, but didn't realize that each layer needed a template also. Thanks! Wendell ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] geotransform
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 http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] need help with query
You need some way of presenting the results of the query, hence the use of the template keyword... Glad it was an easy fix though. Steve On 6/25/2009 at 9:24 AM, in message 20090625142437.ga3...@q.rho.net, Wendell Turner wend...@enflight.com wrote: On Wed, Jun 24, 2009 at 11:48:14PM -0500, Steve Lime wrote: I'll start with the obvious questions: 1) are the layers queryable (e.g. is a TEMPLATE set?) Umm..., it wasn't obvious to me. That was it. I had a template for the map, but didn't realize that each layer needed a template also. 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] geotransform
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 +33 4 79 26 57 97 On Thu, Jun 25, 2009 at 17:04, Charlotte Declercq c.decle...@alkante.comwrote: 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 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] geotransform
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
Re: [mapserver-users] geotransform
I've just committed this to the 5.4 branch, so it will be available in 5.4.2 as for your question, geomtransform replaced the type keyword of rfc45, so the correct answer is to use geomtransform (as per stated in the user documentation) regards, thomas www.camptocamp.com +33 4 79 26 57 97 On Thu, Jun 25, 2009 at 18:29, Charlotte Declercqc.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-us...@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
[mapserver-users] json query resulte?
Does the OUTPUTFORMAT allow for json or geojson, as mentioned here? http://mapserver.org/development/rfc/ms-rfc-36.html Are there any examples of its use? Thanks, Wendell ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] json query resulte?
Yes, this is works but I don't have any working examples handy. I've tended to create javascript src files on-the-fly rather than just objects. Steve On 6/25/2009 at 2:32 PM, in message 20090625193247.ga9...@q.rho.net, Wendell Turner wend...@enflight.com wrote: Does the OUTPUTFORMAT allow for json or geojson, as mentioned here? http://mapserver.org/development/rfc/ms-rfc-36.html Are there any examples of its use? 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] javascript query template examples
Here's one example using new-style templating (recommend MapServer 5.4.1). We're querying some data and building a function that can be used to populate a drop down list on a page. In this case I'm returning a javascript file on-the-fly. You can also create javascript as part of a larger HTML page or just plain JSON or GEOJSON output. Anyway, please ask questions if you need to. The TEMPLATE: // MapServer Template function updateCountyList(element) { var option; [resultset layer=counties][feature] option = new Option([CTY_NAME], [shpext format=$minx,$miny,$maxx,$maxy precision=0 expand=10%]); try { element.add(option, null); } catch(e) { element.add(option); }[/feature][/resultset] } 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 The call to the CGI to run it is: script src=http://maps.dnr.state.mn.us/cgi-bin/mapserv54?map=demo.mapqlayer=countiesqformat=county_select_listmode=nquery;/script The output: function updateCountyList(element) { var option; option = new Option(Clearwater, 304963,5219538,337550,5326697); try { element.add(option, null); } catch(e) { element.add(option); } option = new Option(Aitkin, 434591,5106383,498803,5213702); try { element.add(option, null); } catch(e) { element.add(option); } option = new Option(Chisago, 486969,5013450,529584,5066587); try { element.add(option, null); } catch(e) { element.add(option); } option = new Option(Blue Earth, 387528,4852924,441106,4904495); try { element.add(option, null); } catch(e) { element.add(option); } } On 6/25/2009 at 1:49 AM, in message 200906250649.n5p6ncsn007...@atom.scu.edu.au, Greg Luker glu...@scu.edu.au wrote: Hi mapserver-users, Steve Lime has indeed explained bits of using javascript in CGI query templates, but I'm still lost. Are there any examples showing how to use javascript in a query template to do things like, for example, format the returned query result list to remove duplicate records? Thanks, Greg. Greg Luker GIS Lab Manager, Southern Cross University Lismore, AUSTRALIA. glu...@scu.edu.au phone 61 2 66203026 ___ 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] javascript query template examples
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? Anyway, please ask questions if you need to. Ok! The TEMPLATE: // MapServer Template function updateCountyList(element) { var option; ... } So, where does this template go? 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. 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. 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 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? The call to the CGI to run it is: script src=http://maps.dnr.state.mn.us/cgi-bin/mapserv54?map=demo.mapqlayer=countiesqformat=county_select_listmode=nquery;/script Aha! qformat=name_of_the_output_format Thanks, Wendell ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] javascript query template examples
Hi, At 06:13 AM 26/06/2009, Steve Lime wrote: Here's one example using new-style templating (recommend MapServer 5.4.1). We're querying some data and building a function that can be used to populate a drop down list on a page. In this case I'm returning a javascript file on-the-fly. You can also create javascript as part of a larger HTML page or just plain JSON or GEOJSON output. Anyway, please ask questions if you need to. Thanks very much for this Steve! I'll digest it and get back to the list if (when) I have any further questions. Thanks, Greg. Greg Luker GIS Lab Manager, Southern Cross University Lismore, AUSTRALIA. glu...@scu.edu.au phone 61 2 66203026 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users