This content has been marked as final. Show 3 replies
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
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 http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/74/spatial-pipelining 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:
The COGO and GEOM package and the T_Vector object are available for download from my website.
select T_Vector(va.vector_id, va.element_id, va.subelement_id, va.startCoord, va.endCoord).AsSdoGeometry(null) as geom, codesys.Cogo.DD2DMS( 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>;
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.