Database Reference
In-Depth Information
SELECT azimuth
FROM index_query
ORDER BY dist
LIMIT 1;
$$ LANGUAGE SQL;
This function will calculate the geometry's angle to the nearest road line. Now, to
construct geometries using this calculation, run the following function:
CREATE TABLE chp04.tsr_building AS
SELECT
ST_Rotate(ST_Envelope(ST_Buffer(the_geom, 20)),
radians(90 -
chp04.angle_to_street(addr.the_geom)),
addr.the_geom)
AS the_geom FROM
chp04.knn_addresses addr
LIMIT 500
;
How it works...
Inthefirststep,wearetakingeachofthepointsandfirstapplyingabuffertothem
of 20 feet:
ST_Buffer(the_geom, 20)
Then,wecalculatetheenvelopeofthebuffer,providinguswithasquarearoundthat
bufferedarea.Thisisaquickandeasywaytocreateasquaregeometryofaspeci-
fied size from a point:
ST_Envelope(ST_Buffer(the_geom, 20))
Search WWH ::




Custom Search