[postgis-users] makepolygon with geom info
Obe, Regina
robe.dnd at cityofboston.gov
Wed Jul 2 09:23:21 PDT 2008
Typo again should be
DATA "newgeom FROM (SELECT Max(f.gid) as newgid, f.name,
ST_MakePolygon(ST_MakeLine(f.the_geom)) As newgeom
FROM (SELECT name, 0 as psort, gid, the_geom
FROM foll
UNION ALL
SELECT fs.*
FROM
(SELECT DISTINCT ON(name) name, 1 As psort, gid ,
the_geom
FROM foll
ORDER BY name, gid) fs
ORDER BY 1,2,3) As f
WHERE f.name = 'abc'
GROUP BY f.name) As foo USING UNIQUE newgid USING SRID=4326" (change
4326 with your SRID).
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Obe,
Regina
Sent: Wednesday, July 02, 2008 11:55 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] makepolygon with geom info
I've never tried doing that complicated of a query in Mapserver so not
sure it will fly. Well I did try once, but it was too slow so I just
created a table out of the statement
If you wanted to try the complex query
DATA "newgeom FROM (SELECT Max(f.gid) as newgid, f.name,
ST_MakePolygon(ST_MakeLine(f.the_geom)) As newgeom
FROM (SELECT name, 0 as psort, gid, the_geom
FROM foll
UNION ALL
SELECT fs.*
FROM
(SELECT DISTINCT ON(name) name, 1 As psort, gid ,
the_geom
FROM foll
ORDER BY name, gid) fs
ORDER BY 1,2,3) As f
WHERE f.name = 'abc'
GROUP BY f.name) As foo USING UNIQUE newid USING SRID=4326" (change
4326 with your SRID).
Alternatively just create a new table
SELECT * INTO follpoly
FROM
(SELECT Max(f.gid) as newgid, f.name,
ST_MakePolygon(ST_MakeLine(f.the_geom)) As newgeom
FROM (SELECT name, 0 as psort, gid, the_geom
FROM foll
UNION ALL
SELECT fs.*
FROM
(SELECT DISTINCT ON(name) name, 1 As psort, gid ,
the_geom
FROM foll
ORDER BY name, gid) fs
ORDER BY 1,2,3) As f
WHERE f.name = 'abc'
GROUP BY f.name) As foo;
ALTER TABLE follpoly
ADD CONSTRAINT follpoly_pkey PRIMARY KEY(newgid);
then your mapserver data part would just be
DATA "newgeom FROM follpoly USING UNIQUE newid USING SRID=4326"
You might also want to manually put in an entry in geometry_columns
table since some GIS apps require it.
Hope that helps,
Regina
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
S.Reena
Sent: Wednesday, July 02, 2008 9:39 AM
To: postgis-users at postgis.refractions.net
Subject: Re: [postgis-users] makepolygon with geom info
Yupp that is done... now im trying to include that newgeom in DATA
section of
my map file to make a polygon ....bt it isnt wrking....this newgeom can
be
used for this or not....
S.Reena wrote:
>
> I have a table with foll fields( the_geom, name, latlon, ....)...i
wanted
> to make a polygon by using those points whose name like 'abc' and put
it
> in the map...
>
> how to do dis?
>
--
View this message in context:
http://www.nabble.com/makepolygon-with-geom-info-tp18214128p18237679.htm
l
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list