[postgis-users] Dynamic Bounding boxes
Obe, Regina
robe.dnd at cityofboston.gov
Mon Oct 22 05:00:58 PDT 2007
I'm just wandering about this since I have found work-arounds for this
so its not much of a bother aside from when loading a new db.
Is there a technical reason why we don't allow casting a BOX from a
dynamic string (text) although you can from a static string (cstring).
e.g.
I can do this:
ST_SetSRID(CAST('BOX(33863.73046875 777606.3125,35348.73046875
778517.3125)' as box2d), 26986)
But I can not do this
ST_SetSRID(CAST('BOX(33863.73046875 777606.3125 ' || ',35348.73046875
778517.3125)' as box2d), 26986)
--To get around this minor inconvenience I've been using a function like
this
CREATE FUNCTION pgis_makeboxgeom(xmin float, ymin float, xmax float,
ymax float, SRID int)
RETURNS geometry As
$$
SELECT ST_GeomFromText('POLYGON((' || $1 || ' ' || $2 || ',' || $1 || '
' || $4 || ',' || $3 || ' ' || $4 || ', ' || $3 || ' ' || $2 || ',' ||
$1 || ' ' || $2 || '))', $5)
$$
language 'sql' IMMUTABLE STRICT;
SO I can create dynamic boxes using syntax like this.
SELECT
pgis_makeboxgeom(33863.73046875,777606.3125,35348.73046875,778517.3125,
26986)
Thanks,
Regina
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
More information about the postgis-users
mailing list