[postgis-users] GIS functions
El Nico
nicky666 at gmail.com
Thu May 5 13:37:13 PDT 2005
> 1) Given two point locations, I want to find the two intersecting points of
> the two 125km virtual circles that surround each point.
Hi Mark,
You could do something like:
Making a 125 km buffer around your points: you got polygons (postgis
polygonizes the circle).
Taking the exterior rings of these polygons: these are closed linestring,
Intersects the two linestring to get the result. zero, one, two points.
In SQL, it would be something like:
select astext(intersection(
(select exteriorRing(buffer(pointFromText('POINT (93 95)'), 125, 50))),
(select exteriorRing(buffer(pointFromText('POINT (280 170)'), 125, 50)))
));
(50 is the number of edges for the approximated circle.
Buffer(...) defaults to 8 segments if third parameter is omitted)
> 2) Given two polygons that touch or maybe overlap somewhat, I want to find
> the polygon representing the perimeter of the shape as if both polygons were
> welded together.
>
Just make the intersection of the 2 polygons. If polygons don't touch,
the intersection will be empty, otherwise, the result will depend on
the shape of the 2 input polygons:
select asText(intersection(
polygonFromText('POLYGON((1 1, 4 1, 3 5, 1 1))'),
polygonFromText('POLYGON((1 3, 6 3, 1 7, 1 3))')
));
Nicolas
More information about the postgis-users
mailing list