<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi, Leo:<BR>
 <BR>
Thank you for your reply!<BR>
May be I did not tell my problem clearly,<BR>
Now, I want to know how i can get the number of points that stand for a polygon.<BR>
Just like the function of NumPoints(geometry) used for linestring.<BR>
 <BR>
And how can I locate each coordinate in the polygon?<BR>
Looking forward your reply!<BR>
Thanks a lot!<BR>
 <BR>
ZHANG Aiguo<BR>
<BR> <BR>
<HR id=stopSpelling>
From: lr@pcorp.us<BR>To: postgis-users@postgis.refractions.net<BR>Date: Wed, 11 Nov 2009 13:39:20 -0500<BR>Subject: Re: [postgis-users] Can I replace all the x and y coordinates of a geometry using PostGIS, Thank you!<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;}
.ExternalClass BODY.ecxhmmessage
{font-family:Verdana;font-size:10pt;}
</STYLE>

<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial>Not sure what you are trying to do, but one of the affine functions like ST_Translate may be what you are looking for.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial><A href="http://www.postgis.org/documentation/manual-1.5SVN/ST_Translate.html">http://www.postgis.org/documentation/manual-1.5SVN/ST_Translate.html</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial>That will move all the points in the geometry a specified amount in x,y,z </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial>Leo</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=ecx281123718-11112009><FONT color=#0000ff face=Arial></FONT></SPAN> </DIV><BR>
<DIV dir=ltr lang=en-us class=ecxOutlookMessageHeader align=left>
<HR>
<FONT face=Tahoma><B>From:</B> postgis-users-bounces@postgis.refractions.net [mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>ZHANGAIGUO<BR><B>Sent:</B> Wednesday, November 11, 2009 11:50 AM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users] Can I replace all the x and y coordinates of a geometry using PostGIS, Thank you!<BR></FONT><BR></DIV>
<DIV></DIV>Hello Postgis-users:<BR><BR>I am a student in Fuzhou University, China.<BR>In using PostGIS,<BR>I encountered a problem as fellows:<BR>How can I replace all the x and y coordinates of a geometry?<BR>The geometry may be point, multipoint, linestring, multilinestring, and so on.<BR>I have tried to use the way as fellows:<BR><BR>CREATE OR REPLACE FUNCTION aigo_coord_offset_basicframe2(geometry, double precision, double precision)<BR>   RETURNS geometry AS<BR> $BODY$<BR> declare i integer; <BR> compress geometry; <BR>geom1 geometry;<BR> begin<BR> i:=1;<BR> geom1:=ST_GeomFromText('LINESTRING(0 0, 0.0001 0.0001)',21460);<BR> while i<= ST_NumPoints($1) loop<BR> geom1:=ST_AddPoint(geom1,ST_MakePoint(int2(ST_X(ST_PointN($1,i))-$2),int2(ST_Y(ST_PointN($1,i))-$3)));<BR> i:=i+1;<BR> end loop;<BR> geom1:=ST_RemovePoint(geom1,0);<BR>geom1:=ST_RemovePoint(geom1,0);<BR>compress:=geom1;<BR>return compress;<BR>end $BODY$<BR>   LANGUAGE 'plpgsql' VOLATILE<BR>  COST 100;<BR> ALTER FUNCTION aigo_coord_offset_basicframe2(geometry, double precision, double precision) OWNER TO post;<BR> <BR> The way above is just applied to LINESTRING geometry type,<BR> and it is inefficient.<BR> <BR> Are there any other solutions to accomplish it?<BR> Thank you!<BR><BR> Sincerely Yours!<BR> ZHANG Aiguo<BR><BR>
<HR>
Messe nger保护盾2.0,更安全可靠的Messenger聊天! <A href="http://im.live.cn/safe/">现在就下载!</A>                                         <br /><hr />Messenger保护盾2.0,更安全可靠的Messenger聊天! <a href='http://im.live.cn/safe/' target='_new'>现在就下载!</a></body>
</html>