[Oracle]在数据库中实现地图匹配

The method to do the map match

1 The algorithm procedures

First ,we should find the most nearest road to the point from all roads in haerbin;

Second, we should find the most nearest point to the point from the road.

For example, as figure 1 ,we will do the map match for the point O.

First ,we choose the most nearest road A by compare the distance between O and A with the distance between O and B.

Second, we choose the most nearest point A3 by compare the distance between O and A1,

the distance between O and A2, the distance between O and A3 with the distance between O and A4.

 

 

 技术分享 

                   Figure 1

2 The algorithm code – oracle

select g.id into abcid from h_gl g  where

sdo_nn(g.geom,SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(In_X,In_Y, null),NULL,NULL),‘SDO_NUM_RES=1‘)=‘TRUE‘;

 Select sdo_lrs.convert_to_lrs_geom(sdo_lrs.project_pt(g.geom,m.DIMINFO, sdo_geometry(3001, 8307,                                

                                                       null, sdo_elem_info_array(1, 1,1), sdo_ordinate_array(In_X, In_Y, null))))

v_sql :=‘update table t set t.road_id=‘||abcid||‘,t.longtitude_newgps =‘||v_taxi_pt.SDO_ORDINATES(1) ||‘,

t.latitude_newgps=‘||v_taxi_pt.SDO_ORDINATES(2)||‘ where t.gpsdata_id =‘||IN_GPSDATA_ID;

        

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。