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

Daniel Grum daniel.grum at unibw.de
Thu Aug 20 07:29:07 PDT 2009


Daniel Grum schrieb:
> Daniel Grum schrieb:
>> Pavel Iacovlev schrieb:
>>> st_intersection(st_envelope(st_buffer(t1.the_geom, $radius)), t2. 
>>> the_geom)
>>>
>>> 2009/8/18 Daniel Grum <daniel.grum at unibw.de>:
>>>  
>>>> 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
>>>>
>>>>     
>>>
>>>
>>>
>>>   
>> I try solve the problem with your message:
>>
>> SELECT st_intersection(st_envelope(st_buffer('holzfaeller.the_geom', 
>> 10, 'quad_segs=8')),wald_by.the_geom);
>>
>>
>> I get this error message:
>>
>> FEHLER:  parse error - invalid geometry
>>
>> ********** Fehler **********
>>
>> FEHLER: parse error - invalid geometry
>> SQL Status:XX000
>>
>> What do you think is the problem in this case.
>> Is there a understaning mistake in my SQL order.
>>
>> Thanks,
>> Daniel
>>
> I thing I solved the problem:
>
> SELECT st_intersection(st_envelope(st_buffer(a.the_geom,1)),b.the_geom)
> FROM public.holzfaeller a, public.wald_by b
> (WHERE a.gid=3);   //not necessary
>
> Thank You Pavel for the fast answer!
>
>
The problem now:

this order calculates a lot of points and the intersection with the 
layer "wald_by" can't be solved because the geo data typ is: 
GEOMETRYCOLLECTION.

I tried to generate a rectangle with ST_GeomGromText instaead of the 
st_buffer that generates a circle:

ST_GeomFromText('POLYGON((st_x(a.the_geom)-2.0 
st_y(a.the_geom)+2.0,st_x(a.the_geom)+2.0 
st_y(a.the_geom)+2.0,st_x(a.the_geom)+2.0 
st_y(a.the_geom)-2.0,st_x(a.the_geom)-2.0 
st_y(a.the_geom)-2.0,st_x(a.the_geom)-2.0 st_y(a.the_geom)+2.0))')

PostgreSQL don't alerted me with a mistake, but if I would look for the 
generated data, PostgreSQL isn't able to do this and said "Bricht ab".

What can be the reason for this?

Thanks
Daniel




More information about the postgis-users mailing list