[postgis-users] getting a square/rectangle arround a point
Kevin Neufeld
kneufeld at refractions.net
Thu Aug 20 08:48:41 PDT 2009
Unless I misunderstand what you are after, why don't you simply expand the bounding box of the point by your required
amount?
ie.
SELECT
ST_AsText(geom),
ST_AsText(ST_Expand(geom, 2))
FROM (SELECT 'POINT(5 5)'::geometry AS geom) AS a;
st_astext | st_astext
------------+--------------------------------
POINT(5 5) | POLYGON((3 3,3 7,7 7,7 3,3 3))
(1 row)
-- Or create a rectangle from a point
SELECT
ST_AsText(geom),
ST_AsText(
ST_Envelope(ST_MakeLine(
ST_MakePoint(ST_X(geom) - 3, ST_Y(geom) - 2),
ST_MakePoint(ST_X(geom) + 3, ST_Y(geom) + 2)
))
)
FROM (SELECT 'POINT(5 5)'::geometry AS geom) AS a;
st_astext | st_astext
------------+--------------------------------
POINT(5 5) | POLYGON((2 3,2 7,8 7,8 3,2 3))
(1 row)
-- Kevin
Daniel Grum wrote:
> Dear Mailing-List,
>
> I want to create a square/rectangle around a point-->via box2d(geometry)
> or buffer(geometry, double precision) for example.
>
> If I have this rectangle I want to intersect this with another
> polygon--> saved in the (geodata) table: wald_by column: the_geom, to
> get information about the area the the "lumberjack" can dig.
> The point in the middle of the rectangle = the point that is saved in a
> table in my database in the table: holzfaeller in the column the_geom!
>
> Is this possible to solve?
> Do I have to save this calculated square/rectangle in an extra/own table?
>
> Thanks for every help.
>
> Daniel
> _______________________________________________
> 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