Oracle Spatial 有一个名为 SDO_LRS 的 linear referencing 包。可用于查找折线的中点坐标。
--In this case, 'sdo' is the name of the sdo_geometry column.
sdo_lrs.convert_to_std_geom(sdo_lrs.locate_pt(sdo_lrs.convert_to_lrs_geom(sdo,3)
,sdo_geom.sdo_length(sdo,3)/2)).sdo_point.x as midpoint_x,
sdo_lrs.convert_to_std_geom(sdo_lrs.locate_pt(sdo_lrs.convert_to_lrs_geom(sdo,3)
,sdo_geom.sdo_length(sdo,3)/2)).sdo_point.y as midpoint_y
奖励积分:
这就是如何将 ESRI 的 SDE.ST_GEOMETRY 转换为 SDO_GEOMETRY 以获取中点坐标:
select
sdo_lrs.convert_to_std_geom(sdo_lrs.locate_pt(sdo_lrs.convert_to_lrs_geom(sdo,3),sdo_geom.sdo_length(sdo,3)/2)).sdo_point.x as midpoint_x,
sdo_lrs.convert_to_std_geom(sdo_lrs.locate_pt(sdo_lrs.convert_to_lrs_geom(sdo,3),sdo_geom.sdo_length(sdo,3)/2)).sdo_point.y as midpoint_y
from
(select
sdo_util.from_wktgeometry(sde.st_astext(shape)) as sdo
from
roads)
这个答案的灵感来自 Code Review 上的一个答案:Calculate the midpoint of a polyline。