[postgis-users] Scale without translate?

Bruce Rindahl rindahl at lrcwe.com
Thu May 17 15:24:04 PDT 2007


In that case the best approach would be to compute the full affine matrix
calculations and call affine().  I just never bothered to compute the
resultant matrix.
Bruce

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Jeff
Dege
Sent: Thursday, May 17, 2007 4:13 PM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Scale without translate?

In my case, these are one-time translations, done during development,
before install.  Whether they take ten seconds or two minutes makes very
little difference.

If I did have users waiting on this function, though, I'd seriously
consider writing a stored procedure that called centroid once, and used
the results and the scaling factor to calculate the appropriate
arguments so that I could have one call to affine(), instead of two
calls to translate and one to scale.

(Can we do an aside to an aside to an aside?

Is the optimizer smart enough to compose multiple translations and
scalings and rotations?  So that when we do a nested
translate(scale(translate))), we only modify the geometry once, instead
of creating the intermediate geometries?

If so, the optimization I described above would gain little.)

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Bruce Rindahl
> Sent: Thursday, May 17, 2007 5:03 PM
> To: 'PostGIS Users Discussion'
> Subject: RE: [postgis-users] Scale without translate?
> 
> Don't know.  How many times will you do this or how large is 
> the table?  If
> it will be an issue then you may want to play with this a bit 
> by loading the
> centroid coordinates into a scratch table and the calling the 
> function below
> with those values.
> Bruce
> 
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Rob Agar
> Sent: Thursday, May 17, 2007 4:00 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Scale without translate?
> 
> Bruce Rindahl wrote:
> > SELECT translate(
> > scale(
> > translate(the_geom,-x(centroid(the_geom)),-y(centroid(the_geom)))
> > ,myScale)
> > ,x(centroid(the_geom)),y(centroid(the_geom)))
> 
> on a side point, is the postgresql optimizer smart enough not to call 
> centroid() four times in this case?
> 
> Rob
> _______________________________________________
> 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






More information about the postgis-users mailing list