[postgis-users] makepolygon with geom info

Obe, Regina robe.dnd at cityofboston.gov
Tue Jul 1 05:53:24 PDT 2008


Try 

Are each of your the_geom single point geometries?
If so I think you can do something of the form

SELECT Max(f.gid) as newgid, ST_MakePolygon(ST_MakeLine(f.the_geom)) As
newgeom, f.name
FROM (SELECT gid, the_geom FROM foll ORDER BY name, gid) As f
WHERE f.name = 'abc'
GROUP BY  f.name 

Although the above assumes that your gid field controls the order of the
points along the line string and that your beginning and ending point
are the same.

If your beginning and ending are not the same - but your order is still
right, then you can do

SELECT Max(f.gid) as newgid, f.name,
ST_MakePolygon(ST_MakeLine(f.the_geom)) As newgeom
FROM (SELECT name, 0 as psort, gid as newsort, 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 


If you leave the WHERE clause out, it will give you a Polygon record for
each unique abc.

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: Tuesday, July 01, 2008 7:33 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] makepolygon with geom info


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-tp18214128p18214128.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.




More information about the postgis-users mailing list