[postgis-users] getting a square/rectangle arround a point

Daniel Grum daniel.grum at unibw.de
Thu Aug 20 09:42:32 PDT 2009


Kevin Neufeld schrieb:
> 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
>
Your request nr.2 is perfect, thank you.
But can use this created polygon to selcet a part of another polygon, in 
my case public.wald_by.the_geom.
Or do I have to save the selcted information in a table and use this for 
the new request???
Because I need to selcet the other polygon to calculate the area of the 
selected part, of public.wald_by.the_geom !

--Daniel



More information about the postgis-users mailing list