[mapserver-users] SQL for Point-Centroid
Burgholzer,Robert
rwburgholzer at deq.virginia.gov
Wed Nov 26 06:34:40 PST 2008
Try the following:
DATA "centroid(the_geom) as the_geom from mytable"
It seems to work fine for me.
Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/
-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jochen
Wagner
Sent: Tuesday, November 25, 2008 5:55 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] SQL for Point-Centroid
Hi,
I have a polygon-layer from a postgis-table:
LAYER
NAME "polylayer"
TYPE polygon
STATUS on
CONNECTIONTYPE postgis
CONNECTION "user=postgres password=mypass dbname=mydb host=localhost
port=5432"
DATA "the_geom from mytable using unique gid"
TEMPLATE "template/query.html"
CLASS
NAME "Polylayer"
STYLE
COLOR 0 100 100
OUTLINECOLOR 0 50 50
WIDTH 2
END
END # CLASS
END
I want to add a point-layer in my mapfile with the centroid of the
polygonlayer, this SQL works:
SELECT x(ST_Centroid(the_geom)) AS xvar, y(ST_Centroid(the_geom)) AS
yvar FROM mytable
My Point-Layer:
LAYER
NAME "pointlayer"
TYPE point
STATUS on
CONNECTIONTYPE postgis
CONNECTION "user=postgres password=mypass dbname=mydb host=localhost
port=5432"
DATA "?????????????????????????????????????????????"
TEMPLATE "template/query.html"
CLASS
NAME "Pointlayer"
COLOR 255 0 0
SYMBOL 'circle'
SIZE 10
END # CLASS
END
My Question: How can I use my SQL in Mapserver?
Thanks
Jochen
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list