[postgis-users] ST_Translate

Martin Davis mbdavis at refractions.net
Wed Jul 9 09:07:35 PDT 2008


Looks to me like you're translating each geometry by a different 
amount.  Using the SQL below, the centroid of each individual geom will 
be moved to be coincident with the centroid of spatial_ref.the_geom.

You need to determine a single delta x,y to translate them all by, if 
you want them to be in the same position relative to each other.

Bob Pawley wrote:
> Hi Regina
>
> Following is the query I am using.
>
> The shapefile is also attached if any one wants to try it.
>
> The shape was converted from a DXF file with the default SRID.
>
> Bob
> insert into entity (the_geom, position)
> select
> st_translate (public.process.the_geom,
> st_x (st_centroid(spatial_ref.the_geom)) -
> st_x (st_centroid (public.process.the_geom)),
> st_y (st_centroid(spatial_ref.the_geom))-
> st_y (st_centroid (public.process.the_geom))), ('i')
> from  spatial_ref,  process
> where spatial_ref.position_ = '1' ;
>
>
>
>
>
> ----- Original Message ----- From: "Paragon Corporation" <lr at pcorp.us>
> To: "'PostGIS Users Discussion'" <postgis-users at postgis.refractions.net>
> Sent: Wednesday, July 09, 2008 12:11 AM
> Subject: RE: [postgis-users] ST_Translate
>
>
>> Bob,
>>
>> Doesn't quite make sense to me why translating before ST_Union would 
>> cause
>> distortion if you are translating all the same amount.
>>
>> What is the SRID of the data you are translating and what does your
>> translate query and union query look like?
>>
>> Thanks,
>> Regina
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bob
>> Pawley
>> Sent: Tuesday, July 08, 2008 5:30 PM
>> To: PostGIS Users Discussion
>> Subject: [postgis-users] ST_Translate
>>
>> I've imported a shapefile that requires six rows in the table.
>>
>> When I translate that shape, of six rows, to another location the shape
>> becomes distorted.
>>
>> When I collect the six rows by using ST_Union, then translate the 
>> single row
>> to the new position, there is no distortion.
>>
>> Is there a method of using ST_Translate, without also using ST_Union, 
>> and
>> still avoid the distortion of the shape??
>>
>> I need the  geometries of the shape separate to be able to identify the
>> parts of the shape I need. I seem to lose this informaion when I employ
>> ST_Union.
>>
>> Bob
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users 
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list