public static void CreateNewGpxFile()
{
gpxType Gpxfile = new gpxType();
trkType Tracking1 = new trkType();
trksegType TrackingRegister = new trksegType();
wptType Waypoint1 = new wptType();
Waypoint1.lon = ( decimal) 4.13;
Waypoint1.lat = ( decimal) 51.7;
wptType Waypoint2 = new wptType();
Waypoint1.lon = ( decimal)4.18;
Waypoint1.lat = ( decimal)51.6;
List<wptType > Waypoints = new List<wptType >();
Waypoints.Add(Waypoint1);
Waypoints.Add(Waypoint2);
TrackingRegister.trkpt = Waypoints.ToArray();
Tracking1.trkseg = TrackingRegister.SingleItemAsArray< trksegType>();
Gpxfile.trk = Tracking1.SingleItemAsArray< trkType>();
string Gpxfilestring = FileToStringBuilder(@"c:\temp\test.gpx" ).ToString();
Gpxfile = DeserializeFromXml<gpxType>(Gpxfilestring);
}
|
1. Go to http://www.topografix.com/GPX/1/1/gpx.xsd and dowload the xsd schema to C:\temp\ of your computer.
2. Start the Visual Studio 2010 CMD
3. execute the command : xsd c:\temp\gpx.xsd /classes /out:c:\temp\