c# - Dynamically sequence GPS points along a road -


i storing gps points along index -- reference these points in question gps[0], gps[1], gps gps location , [n] index in array of gps locations.

here how going storing locations (in example array contains 11 locations):

gps[0] = start of road - @ first index

gps[10] = end of road - @ last index

gps[ 1 - 9 ] = points in between start , end of road

note: not of [ 1 - 9 ] points captured @ same time example gps[1] , gps[2] may captured on monday , gps[3] may captured on wednesday , gps[ 4 - 9 ] may captured month now. if not captured... ignored.

additionally, gps location may captured "out of sequence"... mean "out of sequence" is, points captured along road, not in same order encounter them when traveling down road start end.

which leads me questions in algorithm :

( note 'map api' software / service has mapping api )

//--- there map api this? set currentpoint = map.api.findpoint( gpsarray[0] )  //--- there map api this? set endpoint = map.api.findpoint( gpsarray[10] )  list<int> sequencedindicies = new list<int>;     while ( currentpoint != endpoint ) {      // there map api travel down road current point     // x feet , set current point location ?      currentpoint = map.api.travelthismanyfeetdownroad( currentpoint, 100 )      // loop through points , check them against current road point     for( int i= 1; i<10; i++ )     {         // there map api function take point, "current" point          // , tell if point within x feet of current point         //         // ( alternatively use haversine function if map api not exist )          //         if( map.api.isnear( currentpoint, gpsarray[i],  50 ) )  <--- need         {             sequencedindicies.add( );             break;         }     } }  // move gps points new sequenced order reindexgpsarray( gpsarray, sequenceindicies ) 

i looking c# example code deals map api functionality

another note... not require user interface display...

i can use lat/lon... however, gps coordinates use not important... important map api functionality can travel down road , determine if point close current point or not.

thanks

using google maps api.. figured out:

here code:

 http://maps.googleapis.com/maps/api/directions/xml?origin=37.332829,-122.053389&destination=37.320885,-121.995869&waypoints=optimize:true|37.326531,-122.006750|37.334222,-122.037787|37.333721,-122.021086&sensor=false 

here part of response orders way points:

 <waypoint_index>1</waypoint_index>  <waypoint_index>2</waypoint_index>  <waypoint_index>0</waypoint_index> 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -