This discussion is archived
3 Replies Latest reply: Oct 4, 2012 5:21 PM by Simon Greener RSS

determination the Direction and Borders problem

771409 Newbie
Currently Being Moderated
hi all

I Have Problem in How to determination the Direction And the neighbor For polygon As in the picture.

picture in (

I Want determination :

From north : polygon with object Id=.....
From south : streets with object Id=.....
From east :streets with object Id=.....
From west : polygon with object Id=.....

I have Started and I Identified the Directions I get line of land with line 29 meters is the North
and line with 25.4 is south ......

Now how I can Determination the border of land ?
manes :
north ... land with number 2
south ... street with 15 meters width

Can eny one Help Or have Good idea ?
  • 1. Re: determination the Direction and Borders problem
    yhu Journeyer
    Currently Being Moderated
    Not sure that I fully understand your problem.
    Here are some functions (or operator) you may be able to use:

    1) sdo_geom.relate( geom1, 'touch', geom2, tolerance) (or operator sdo_touch()) to get neighbors
    2) for each neighbor, bnd := sdo_geom.sdo_intersection(geom1, geom2, tolerance) to get the common boundary
    3) compare sdo_geom.sdo_centroid(geom1, tolerance) and sdo_geom.sdo_centroid(bnd, tolerance) to decide the direction
  • 2. Re: determination the Direction and Borders problem
    Luc Van Linden Pro
    Currently Being Moderated

    In addition for the direction you can have a look at an older contribution :

    Re: Query based on direction

  • 3. Re: determination the Direction and Borders problem
    Simon Greener Journeyer
    Currently Being Moderated
    Some real data (ie the sdo_geometry of the polygon in the image) would be useful.

    The main issue here is not so much the writing of the bearings and distances against the line segments,
    but determining which segments should be so labelled.

    I have dealt with the basics of extracting and marking polygon segments in in articles like this before.

    But this is roughly how I would go about removing those shared boundary segments so that I only had those segments that front a street:
    select T_Vector(va.vector_id, va.element_id, va.subelement_id, va.startCoord, va.endCoord).AsSdoGeometry(null) as geom,
                 codesys.Cogo.Bearing (va.startCoord.x,va.startCoord.y,va.endCoord.x,va.endCoord.y) * (180/codesys.Constants.PI) ) AS bearing,
           ROUND(codesys.Cogo.Distance(va.startCoord.x,va.startCoord.y,va.endCoord.x,va.endCoord.y),2) AS distance
      from source_table a,
           table(ST_Vectorize(a.geom)) va,
           source_table b
     where a.<primary key> = <value>
       and sdo_covers(c.geom,
                      T_Vector(va.vector_id, va.element_id, va.subelement_id, va.startCoord, va.endCoord).AsSdoGeometry(null)) = 'TRUE'
       and c.<primary key> <> a.<primary key>;
    The COGO and GEOM package and the T_Vector object are available for download from my website.

    In short you:

    1. Take the base polygon;
    2. Break it into 2 vertex segments;
    3. Use each segment to find a polygon in the original table it lies on;
    4. Ensure that the found polygon is not the same as the source of the segments;
    5. Generate the bearing and distance.



  • Correct Answers - 10 points
  • Helpful Answers - 5 points