1, showing
2. Action Trajectory data
<span style= "FONT-SIZE:18PX;" >[{"Locationx": "121.42619", "Locationy": "31.186655"},{"Locationx": "121.42694", "Locationy": "31.187215"},{" Locationx ":" 121.425961666667 "," Locationy ":" 31.187475 "},{" Locationx ":" 121.425641666667 "," Locationy ":" 31.1873733333333 "}]</span>
3. Sample Data Encapsulation
<span style= "FONT-SIZE:18PX;" >//test data datadevicelocation deviceLocation1 = new Datadevicelocation ();d Evicelocation1.setlocationx ("121.42619"); Devicelocation1.setlocationy ("31.186655");D atadevicelocation deviceLocation2 = new Datadevicelocation (); Devicelocation2.setlocationx ("121.42694");d evicelocation2.setlocationy ("31.187215");D atadevicelocation DeviceLocation3 = new Datadevicelocation ();d Evicelocation3.setlocationx ("121.425961666667"); Devicelocation3.setlocationy ("31.187475");D atadevicelocation deviceLocation4 = new Datadevicelocation (); Devicelocation4.setlocationx ("121.425641666667");d evicelocation4.setlocationy ("31.1873733333333"); Locations.add (DeviceLocation4); Locations.add (DeviceLocation3); Locations.add (DeviceLocation2); Locations.add ( DeviceLocation1);</span>
4, coordinate conversion--gps WGS84 coordinates to Baidu coordinates
<span style= "FONT-SIZE:18PX;" >geopoint = Coordinateconvert.fromwgs84tobaidu (new GeoPoint ((int) (Double.valueof (Locations.get (i). Getlocationy ()) * 1E6), (int) (Double.valueof (Locations.get (i). Getlocationx ()) * 1E6)));</span>
5. Add a pushpin layer
<span style= "FONT-SIZE:18PX;" >overlaytest itemoverlay = new Overlaytest (Getresources (). Getdrawable (R.drawable.map_location_icon), MMapView); Mmapview.getoverlays (). Clear (); Mmapview.getoverlays (). Add (Itemoverlay);</span>
6. Fill pushpin Position coordinate data
<span style= "FONT-SIZE:18PX;" >overlayitem item = new Overlayitem (GeoPoint, "", ""); Item.setmarker (Getresources (). Getdrawable (R.DRAWABLE.MAP_ Location_icon)); Itemoverlay.additem (item);</span>
7. Add a track layer
<span style= "FONT-SIZE:18PX;" >mkroute route = new Mkroute (); geopoint[] geopoints = new Geopoint[locations.size ()];route.customizeroute (Geopoints[0], geopoints[ Geopoints.length-1], geopoints); Routeoverlay routeoverlay = new Routeoverlay (this, mmapview); Routeoverlay.setdata (route); Mmapview.getoverlays (). Add (Routeoverlay);</span>