<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
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 />Messenger保护盾2.0,更安全可靠的Messenger聊天! <a href='http://im.live.cn/safe/' target='_new'>现在就下载!</a></body>
</html>