Database Reference
In-Depth Information
Finally,weuse ST_Rotate torotatethegeometrytotheappropriateangle.Hereis
wherethequerybecomeshardertoread.The ST_Rotate functiontakesthreear-
guments:
ST_Rotate(geometry to rotate, angle, origin
around which to rotate)
Thegeometryweareusingisthenewlycalculatedsquare.Theangleistheonewe
calculate using our chp04.angle_to_street function. Finally, the origin around
whichwerotateistheinputpointitself,resultinginthefollowingportionofourquery:
ST_Rotate(ST_Envelope(ST_Buffer(the_geom, 20)),
radians(90
-chp04.angle_to_street(addr.the_geom)),
addr.the_geom);
This gives us some really nice cartography as shown in the following screenshot:
See also
• The Improving proximity filtering with KNN - advanced recipe
• The Translating, scaling, and rotating geometries - advanced recipe
Search WWH ::




Custom Search