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
postgi...@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
2009/8/18 Daniel Grum <danie...@unibw.de>:
--
http://iap.md, The future is open
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!
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
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
Yes, you can expand the bounding boxes on fly and use it to intersect another geometry.
Cheers,
-- Daniel