Re: converting points to circles



Hi Erik!

> we need to transform points in Oracle spatial to circles with a
> given radius in Oracle spatial.

The following function should do it. It is pretty rudimentary (e.g.
no check whether input geometry is really a point), but could be a
starting point. The closest built-in solution I know is
SDO_GEOM.SDO_BUFFER() which creates a polygon shaped buffer zone
around the point.

Regards,

Ben


-- test table
CREATE TABLE SPATIAL_TEST (
GEOMETRY SDO_GEOMETRY
);

-- test data
INSERT INTO SPATIAL_TEST
VALUES (
SDO_GEOMETRY (
2001,
NULL,
NULL,
SDO_ELEM_INFO_ARRAY (1, 1, 1),
SDO_ORDINATE_ARRAY (10, 10)
)
);

-- function to convert point to circle
CREATE OR REPLACE FUNCTION Point2Circle(
point SDO_GEOMETRY,
radius NUMBER)
RETURN SDO_GEOMETRY IS
BEGIN
DECLARE
xorig NUMBER;
yorig NUMBER;
circle SDO_GEOMETRY;
BEGIN
SELECT t.X, t.Y INTO xorig, yorig
FROM SPATIAL_TEST s,
TABLE (SDO_UTIL.GETVERTICES(s.GEOMETRY)) t;
circle := SDO_GEOMETRY (
2003,
NULL,
NULL,
SDO_ELEM_INFO_ARRAY (1, 2003, 4),
SDO_ORDINATE_ARRAY (
xorig - radius, yorig,
xorig + radius, yorig,


xorig, yorig + radius
)
);
RETURN circle;
END;
END;
/

-- test it, radius = 5
SELECT GEOMETRY, Point2Circle(GEOMETRY, 5) FROM SPATIAL_TEST;

-- clean up
DROP TABLE SPATIAL_TEST;
DROP FUNCTION Point2Circle;
.



Relevant Pages

  • Re: A spiral space-filling curve as a natural continuum
    ... geometry from other definitions, towards that then the idea is to get ... There is a notion that a spiral space-filling curve starts from the ... disc to begin and then to generalize) and R^N. ... Then, in considering the points of these circles, which have ...
    (sci.math)
  • Re: The sphere and hyperbolic geometry
    ... My geometry - the surface of the sphere, all points and all circles ... axiom, ...
    (sci.math)
  • Re: Questions (Space)
    ... have to be true for real, flat, unbent, circles. ... For every segment AB and for every segment CD there exists a unique ... He was thinking of ordinary plane geometry, but finding a way to reason ... We might even decide to use the Euclidean ...
    (rec.arts.sf.composition)
  • Re: The sphere and hyperbolic geometry
    ... My geometry - the surface of the sphere, all points and all circles ... axiom, ...
    (sci.math)
  • Atom symbol
    ... circles of the cub-octahedron also known as the four great circles of ... method of classical Greek geometry begins with the point. ... "I agree that the axiomatic method is insufficient in and of itself. ... the notion of vector space is one ...
    (sci.physics)