How to check a GPS coordinate is located on a road?
Ältere Kommentare anzeigen
Hi all,
I have GPS data collected on a vehicle and I need to check the portion of time the vehicle was used on road. To this goal, I have downloaded the shape file of the road network of my area. My algorithm is quite simple: for each GPS coordinate, I compute a circle of 15m and I compute the intersection between the lines in the shape file and the circle. No intersection means the vehicle was not running on a road. Here you can see my code:
function OnRoad=CheckOnRoad(Lat,Lon,ShapeLat,ShapeLon)
rad = 15/1e3; % [m]edit
OnRoad=false(size(Lat));
for i=1:1:length(Lat)
[lonc,latc] = scircle1(Lon(i),Lat(i),km2deg(rad),[],[],[],40);
[lati, loni] = polyxpoly(latc,lonc,ShapeLat,ShapeLon);
OnRoad(i)=not(isempty(loni));
end
However, this code is pretty slow. How could I speed up the code?
Thanks. Best regards,
Pietro
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Vehicle Scenarios finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


