[mapserver-users] Adding a wms layer
Hi all I amtrying to add a wms layer into my application but cannot seem to figure this out. I would like to use the OnEarth layer from NASA. Can anyone point me in the right direction? Many thanks Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Adding a buffer symbol
Hi All Having worked out how to display a selection of features within a mouse click (passing the coordinates to postgis query) and colour coding these using classitem for specified distances away from a mouse click e.g. within 1 decimal degree, within 2 decimal degrees and within 3 decimal degrees. I am wondering how or if it is possible to create concentric circles indicating the buffer distances? Any ideas or pointers would be great! Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: Adding a buffer symbol
Hi Venkat At the moment I am just using the CGI mapserver. I was wondering if this can be done or ben achieved using Labels and symbols? but if needs be then I guess either javascript or php would be used to do this. Many thanks Mark On Mon, Dec 8, 2008 at 11:02 AM, mark balman [EMAIL PROTECTED] wrote: Hi All Having worked out how to display a selection of features within a mouse click (passing the coordinates to postgis query) and colour coding these using classitem for specified distances away from a mouse click e.g. within 1 decimal degree, within 2 decimal degrees and within 3 decimal degrees. I am wondering how or if it is possible to create concentric circles indicating the buffer distances? Any ideas or pointers would be great! Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] passing coordinates to a postgis query
Hi all I am trying to pass latitude and longitude coordinates to a postgis query but I am getting confused. So far I have tried to use the following DATA definition as follows: DATA the_geom FROM (select * from kbapoly where st_distance(the_geom,GeomFromText('Point(%mapy% %mapx%)',4326)) 6) AS myquery using SRID=4326 using unique gid where mapy and mapx are the mapserver X and Y coordinate of mouse click. Alas this is not working and any suggestions or pointers would be most welcomed, Thanks in advance Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Postgis query
Hi All Many thanks to Paul with regards to enabling statement logging (extremely useful to help find out what sql is being sent) and thanks to Carlos for suggesting the joins.. this was the problem which I can happily say that I have resolved. What an amazing combination of software really, Mapserver and Postgis are great products.. Cheers to all Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Postgis query
Hi All I am trying to output a query from postgis using three tables and it is not quite working. First table is a quarter degree grid (spatial table) Second table is a table with each grid cell id along with many species id per grid cell Third table is list of species My query definition works well as the following (using two tables only) select fid_1, the_geom AS the_geom, spcgrid.id as gid, spcid from spcdensity left join spcgrid on spcdensity.fid_1 = spcgrid.fid This produces exactly what I want through mapserver, query a grid cell and it returns a list of species within that grid cell My problem is that I want to return a list of species names so my query at present is defined as: select spcid, spccommonname, fid_1, spcdensity.the_geom, spcid as gid from spcgrid left join species on spcgrid.spcid = species.spcrecid inner join spcdensity on spcdensity.fid_1 = spcgrid.fid Although the query works when run in pgadmin, when I query a grid cell I get a list of one species repeated. I am slightly confused as to what I am missing here, can anyone provide me with some pointers? Thanks in advance Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] dynamic sql
Hi all Finally managed to get everything working.. a case of deleting one of a repeated variable in the template file that was causing the problem! Many thanks for all your help, much appreciated! Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Dynamic SQL
Hi All Many thanks to Pietro Giannini and David Fawcett for your help but I am still struggling with getting a dynamic sql statement to work. I have gone back to trying a simple sql statement in the layer definition which works fine like this: LAYER CONNECTIONTYPE postgis NAME kbapoly CONNECTION user= password= dbname=kba host=localhost DATA the_geom from (select gid, intname, the_geom from kbapoly where intname = 'Tibesti massif') as myquery using SRID=4326 using unique gid STATUS OFF TYPE POLYGON TEMPLATE templates/kbas.html CLASS COLOR 255 0 0 END HEADER templates/kbas_header.html FOOTER templates/kbas_footer.html END However, if I try the following LAYER CONNECTIONTYPE postgis NAME kbapoly CONNECTION user= password= dbname=kba host=localhost DATA the_geom from (select gid, intname, the_geom from kbapoly where intname = %qtest%) as myquery using SRID=4326 using unique gid STATUS OFF TYPE POLYGON TEMPLATE templates/kbas.html CLASS COLOR 255 0 0 END HEADER templates/kbas_header.html FOOTER templates/kbas_footer.html END Together with the following in the template file: input type=hidden name=Name value=[qtest] pbIntName: /bbr textarea name=IntName rows=2 cols=5[qtest]/textarea p hr This returns the following error [Mon Oct 13 16:54:53 2008].386000 msDrawMap(): Image handling error. Failed to draw layer named 'kbapoly'. [Mon Oct 13 16:58:49 2008].733000 prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from (select gid, intname, the_geom from kbapoly where intname = %qtest%) as myquery WHERE the_geom setSRID('BOX3D(-179.699499165275 -120.200333889816,180.300500834725 119.599332220367)'::BOX3D, 4326 )' Postgresql reports the error as 'ERROR: syntax error at or near % LINE 1: ...d, intname, the_geom from kbapoly where intname = %qtest%) a... Am I missing something obvious and doing something wrong? Any further suggestions would be gratefully received Thanks Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] dynamic sql
Hi all Many thanks for your iputs to this. I have managed to get the simple query as follows working; DATA the_geom from (select gid, intname, the_geom from kbapoly where intname = '%mquery%') As myquery using SRID=4326 using unique gid It was a simple case of quoting the %mquery% (thought I had tried that..) Now I want to move onto my original query that allows a user to enter a latitude, longitude and a distance and show all polygons that fall within the given buffer distance e.g. DATA the_geom FROM (select * from kbapoly where st_distance(the_geom,GeomFromText('Point(0 1)',4326)) 6) AS myquery using SRID=4326 using unique gid I have tried the following: DATA the_geom FROM ( '%mquery%') AS myquery using SRID=4326 using unique gid and entering the appropriate sql into the text box select * from kbapoly where st_distance(the_geom,GeomFromText('Point(0 1)',4326)) 6 returns the error message: msDrawMap(): Image handling error. Failed to draw layer named 'kbapoly'. prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from ('%(mquery)%') AS myquery WHERE the_geom setSRID('BOX3D(-179.699499165275 -120.200333889816,180.300500834725 119.599332220367)'::BOX3D, 4326 )' Postgresql reports the error as 'ERROR: syntax error at or near '%(mquery)%' LINE 1: ...ection(force_2d(the_geom)),'NDR'),gid::text from ('%(mquery)... ^ I am going to have a go at using Pietro Giannini idea of using his javascript idea, any more insights would be most welcomed Thanks again Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] dynamic sql mapserver
Hi all I am trying to figure out the way to create dynamic sql using mapserver (using the basic demo application under MS4W) and postgres/postgis. I have created various queries that work ok as follows: LAYER CONNECTIONTYPE postgis NAME qdistance CONNECTION user= password= dbname=test host=localhost DATA the_geom from (select * from kbapoly where st_distance(the_geom,GeomFromText('Point(1 0)',4326)) 6) as myquery using SRID=4326 using unique gid STATUS OFF TYPE POLYGON TEMPLATE templates/kbas.html CLASS COLOR 255 0 0 What I would like to be able to do is pass user defined variables e.g. latitude, longitude and distance somehow. I have read various mapserver/postgis workshop docs by Paul Ramsey and others but cannot get anything to work. I have defined the Layer thus: LAYER CONNECTIONTYPE postgis NAME qdistance CONNECTION user= password= dbname=test host=localhost DATA the_geom from (%sql%) as myquery using unique gid STATUS OFF TYPE POLYGON TEMPLATE templates/kbas.html CLASS COLOR 255 0 0 Within the basic.html page I have added the following: pbQuery: /bbr textarea name=sql rows=3 cols=100[sql]/textarea p When I try adding the sql statement to the text box select * from kbapoly where st_distance(the_geom,GeomFromText('Point(1 0)',4326)) 6 I keep getting the following message: msDrawMap(): Image handling error. Failed to draw layer named 'qdistance'. prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from (%sql%) as myquery WHERE the_geom setSRID('BOX3D(-179.699499165275 -120.200333889816,180.300500834725 119.599332220367)'::BOX3D, find_srid('','(%sql%) as myquery','the_geom') )' Postgresql reports the error as 'ERROR: syntax error at or near % LINE 1: ...ection(force_2d(the_geom)),'NDR'),gid::text from (%sql%) as ... ^ ' More Help: Error with POSTGIS data variable. You specified 'check your .map file'. Standard ways of specifiying are : (1) 'geometry_column from geometry_table' (2) 'geometry_column from (sub query) as foo using unique column name using SRID=srid#' Make sure you put in the 'using unique column name' and 'using SRID=#' clauses in. For more help, please see http://postgis.refractions.net/documentation/ Mappostgis.c - version of Jan 23/2004. Can anyone provide me with some pointers? Many thanks Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users