forked from Ruogu7/HMM4MM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFind_Lines_inSameGrid_by_LineID.m
56 lines (45 loc) · 1.92 KB
/
Find_Lines_inSameGrid_by_LineID.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function Lines_inSameGrid = Find_Lines_inSameGrid_by_LineID ( LineID )
%% Find_Lines_inSameGrid_by_LineID function description:
% Imput: LineID
% Output:
% Lines_inSameGrid: Line ID Set
%
% Example
% Edge_ID_Set
% Lines_inSameGrid = Find_Lines_inSameGrid_by_LineID ( 35261 )
% Revision Notes:
% (10/04/14)
% by shenghua chen
% step 1: find the grid id set in which the line pass through
% step 2: get all the line in the these grid id.
%% step 1: find the grid id set in which the line pass through
load Lines_in_GPS_Area_with_GridID.txt;
kk = ismember(Lines_in_GPS_Area_with_GridID(:,1),LineID);
TheRecord = Lines_in_GPS_Area_with_GridID(kk, :);
GridID_num = TheRecord(2);
GridIDSet_of_line = TheRecord(3:(GridID_num+2));
%% step 2: get all the line in the these grid id.
load GridID_LineID_near_GPS_Trajectory.txt;
Line_in_grid_Set = [];
for i_grid = 1:GridID_num
% grid
GridIDSet_of_line(i_grid);
mark_gridID = ismember(GridID_LineID_near_GPS_Trajectory(:,1),GridIDSet_of_line(i_grid));
GridID_lineID_record = GridID_LineID_near_GPS_Trajectory(mark_gridID,:);
% some grid do not contain lines
if size(GridID_lineID_record,1) == 0
LineID_Set_inGrid_record = [];
end
% grid do contain lines
if size(GridID_lineID_record,1) > 0
LineNum = GridID_lineID_record(2);
LineID_Set_inGrid_record = GridID_lineID_record(3:(2+LineNum));
end
Line_in_grid_Set = union(Line_in_grid_Set, LineID_Set_inGrid_record);
end
Lines_inSameGrid = Line_in_grid_Set;
% %% visualizaiton
% for i_line = 1:size(Lines_inSameGrid,2)
% Visualization_road_link_by_line_ID ( Lines_inSameGrid(i_line) );
% end
end