oracle spatial 给定线段 和某点到线段端点的距离,求某点的经纬度

需求如标题
在网上找了很久,都是一些数学公式,但是套过来之后,发现结果不正确,最后还是翻阅oracle的官方文档。
http://docs.oracle.com/cd/E24693_01/appdev.11203/e11830/sdo_util.htm

要找的过程在这里边。


SDO_UTIL.POINT_AT_BEARING

Format

SDO_UTIL.POINT_AT_BEARING(

start_point IN SDO_GEOMETRY,

bearing IN NUMBER,

distance IN NUMBER

) RETURN SDO_GEOMETRY;

看描述
[b]Description[/b]

Returns a point geometry that is at the specified distance and bearing from the start point.

[b]bearing[/b]
Number of radians, measured clockwise from North. Must be in the range of either -pi to pi or 0 to 2*pi. (Either convention on ranges will work).

[b]distance[/b]
Number of meters from start_point and along the initial bearing direction to the computed destination point. Must be less than one-half the circumference of the Earth.

大概满足我的需求。这段话意思应该是,返回一个点,改点的位置在起始点按照指定方位的一段距离上
(bearing应该是方位的意思),其实就是弧度。
那么这个弧度怎么得知呢?

继续往下看,
To compute the bearing and tilt from a start point to an end point, you can use the SDO_UTIL.BEARING_TILT_FOR_POINTS procedure.

也就是说,如果我知道两个点,那么这个线段的弧度我就可以算出来,理论上,线段上所有的点坐标也就可以算出来了。

所以,point1,point2 ,距离point1距离200米的点的坐标怎么求呢?

首先,用
SDO_UTIL.BEARING_TILT_FOR_POINTS(

start_point IN SDO_GEOMETRY,

end_point IN SDO_GEOMETRY,

tol IN NUMBER,

bearing OUT NUMBER,

tilt OUT NUMBER

) RETURN SDO_GEOMETRY;
SDO_UTIL.BEARING_TILT_FOR_POINTS(point1,point2,0.00005,radians,tilt) 计算出radians,tilt 一个顺时针,一个逆时针,我需要用顺时针的弧度。
然后再用radians和point1和距离,计算线段上的点。

当然,如果线段不足200米,那么点就飞到外边了。
GEOMETRY point3 :=SDO_UTIL.BEARING_TILT_FOR_POINTS(point1,ra,200);

此时point3就得出了。
转载自:https://blog.csdn.net/zxp209/article/details/84815293

You may also like...