[postgis-users] Scale without translate?
Simon Greener
simon at spatialdbadvisor.com
Fri May 18 22:01:49 PDT 2007
Bruce,
> 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?
You could re-write this as a nested query and compare the performance...
This is a re-write of the select part of your query...
SELECT translate( scale( translate(the_geom,-dx,-dy),
myScale),
dx,dy)
FROM (SELECT the_geom as the_geom,
x(cent_geom)) as dx,
y(cent_geom)) as dy
FROM (SELECT the_geom,
centroid(the_geom) as cent_gom
FROM ......you data table...
)
)
regards
S
--
SpatialDB Advice and Solutions Architecture,
Oracle Spatial, ArcSDE, Manifold GIS, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
Email: simon at spatialdbadvisor.com
Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515
Latitude: -43.01530
NAC:W80CK 7SWP3
More information about the postgis-users
mailing list