public void formatTcxGpx(string fileName)
        {
            string ext = Path.GetExtension(fileName);

            if (ext == null)
            {
                string msg = "Format TCX/GPX: Cannot handle files with no extension";
                raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.ERR, msg));
                return;
            }
            if (ext.ToLower().Equals(".tcx"))
            {
                TrainingCenterDatabase tcx = TrainingCenterDatabase.Load(fileName);
                string saveFilename        = getSaveName(fileName, ".formatted");
                if (saveFilename != null)
                {
                    tcx.Save(saveFilename);
                }
            }
            else if (ext.ToLower().Equals(".gpx"))
            {
                gpx    gpx          = gpx.Load(fileName);
                string saveFilename = getSaveName(fileName, ".formatted");
                if (saveFilename != null)
                {
                    gpx.Save(saveFilename);
                }
            }
            else
            {
                string msg = "Format TCX/GPX: Not a supported extension: " + ext;
                raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.ERR, msg));
                return;
            }
        }
        public void findNearPOIFromGpx(string trkFile, string poiFile)
        {
            try {
                GpxResult res =
                    GpsData.findPoiNearGpxTracks(trkFile, poiFile);
                if (res.GPX == null)
                {
                    string msg = "Find Near POI to GPX tracks/routes failed" + NL
                                 + " " + res.Message;
                    raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.MSG, NL + msg));
                    return;
                }
                gpx poiNear = res.GPX;

                string saveFileName = getSaveName(poiFile, ".foundnear");
                if (saveFileName != null)
                {
                    poiNear.Save(saveFileName);
                    string msg = "Find Near POI to GPX tracks/routes:" + NL
                                 + " Tracks/routes file=" + trkFile + NL
                                 + " POI file=" + poiFile + NL
                                 + " Output=" + saveFileName + NL
                                 + " " + res.Message;
                    raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.MSG, NL + msg));
                }
                else
                {
                    return;
                }
            } catch (Exception ex) {
                string msg = "Error finding Near POI from GPX";
                raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.EXC, msg, ex));
                return;
            }
        }
Exemple #3
0
 public GpxFileModel(GpxModel parent, string fileName, gpx gpx)
 {
     Parent   = parent;
     Gpx      = gpx;
     FileName = fileName;
     reset();
 }
Exemple #4
0
        public static void formatSingleTcxGpx(string fileName)
        {
            string ext = Path.GetExtension(fileName);

            if (ext == null)
            {
                Utils.errMsg("formatSingleTcxGpx: Cannot handle files with no extension");
                return;
            }
            if (ext.ToLower().Equals(".tcx"))
            {
                TrainingCenterDatabase tcx = TrainingCenterDatabase.Load(fileName);
                string saveFilename        = getSaveName(fileName, ".formatted");
                if (saveFilename != null)
                {
                    tcx.Save(saveFilename);
                }
            }
            else if (ext.ToLower().Equals(".gpx"))
            {
                gpx    gpx          = gpx.Load(fileName);
                string saveFilename = getSaveName(fileName, ".formatted");
                if (saveFilename != null)
                {
                    gpx.Save(saveFilename);
                }
            }
            else
            {
                Utils.errMsg("Not a supported extension: " + ext);
                return;
            }
        }
Exemple #5
0
        public RootJsonReponse MatchRoute(IEnumerable <GeoPointDTO> geoPointDTOs)
        {
            gpx gpxItem = GetGpxXml(geoPointDTOs);

            var bytes = XmlExtension.SerializeToByteArray(gpxItem);

            var client = new RestClient(BaseUrl);

            var requestAdress = string.Format("?app_id={0}&app_code={1}&routemode=car&filetype=GPX", HereApiConfDTO.AppId, HereApiConfDTO.AppCode);

            var request = new RestRequest(requestAdress, Method.POST);

            request.AddHeader("Content-Type", "application/gpx+xml");
            request.AddParameter("application/gpx+xml", bytes, ParameterType.RequestBody);

            var response = client.Execute(request);

            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                throw new Exception("MatchRoute ex");
            }

            var jsonObj = JsonConvert.DeserializeObject <RootJsonReponse>(response.Content);

            return(jsonObj);
        }
        public void ReadGpxData(GpxFile gpxFile, Stream stream)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(gpx));
            gpx           gpx        = (gpx)serializer.Deserialize(stream);

            if (gpx.trk != null)
            {
                foreach (gpxTrk trkType in gpx.trk)
                {
                    Track track = new Track();

                    foreach (gpxTrkTrkseg trkseg in trkType.trkseg)
                    {
                        if (trkseg.trkpt.Length > 0)
                        {
                            TrackSegment segment = new TrackSegment();
                            foreach (gpxTrkTrksegTrkpt trkpt in trkseg.trkpt)
                            {
                                TrackPoint waypoint = ReadTrackPoint(trkpt);
                                segment.AddPoint(waypoint);
                            }

                            track.AddSegment(segment);
                        }
                    }

                    gpxFile.AddTrack(track);
                }
            }

            if (gpx.wpt != null)
            {
                foreach (gpxWpt wptType in gpx.wpt)
                {
                    TrackPoint waypoint = ReadWayoint(wptType);
                    gpxFile.AddWaypoint(waypoint);
                }
            }

            if (gpx.rte != null)
            {
                foreach (gpxRte rteType in gpx.rte)
                {
                    Track route = new Track();

                    if (rteType.rtept != null)
                    {
                        TrackSegment segment = new TrackSegment();
                        foreach (gpxRteRtept wptType in rteType.rtept)
                        {
                            TrackPoint waypoint = ReadRoutePoint(wptType);
                            segment.AddPoint(waypoint);
                        }
                    }

                    gpxFile.AddRoute(route);
                }
            }
        }
Exemple #7
0
        static void Main(string[] args)
        {
            string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "SimpleGps.db");


            SQLiteConnection databaseConnection = new SQLiteConnection(dbPath);

            databaseConnection.CreateTable <SimpleGpsLocation>();
            databaseConnection.CreateTable <SimpleGpsRoute>();

            var routes = databaseConnection.Table <SimpleGpsRoute>()
                         .ToList();

            for (int i = routes.Count - 1; i > routes.Count - 3; i--)
            {
                SimpleGpsRoute            item   = routes[i];
                IEnumerable <gpxTrkTrkpt> points = databaseConnection.Table <SimpleGpsLocation>().Where(x => x.SimpleGpsRouteId == item.Id)
                                                   .ToList()
                                                   .Select(x => new gpxTrkTrkpt()
                {
                    ele  = x.Altitude,  //.ToString("F1"),
                    lat  = x.Latitude,  //.ToString("F7"),
                    lon  = x.Longitude, //.ToString("F7"),
                    time = x.DateTime,  //.ToString("u").Replace(' ', 'T')
                });

                var exportdata = new gpx()
                {
                    creator  = "com.mihyan.simpletracker",
                    version  = 1.1m,
                    metadata = new gpxMetadata()
                    {
                        link = new gpxMetadataLink()
                        {
                            href = "http://localhost:8080", text = "localhost"
                        },
                        time = points.OrderBy(x => x.time).First().time,
                    },
                    trk = new gpxTrk()
                    {
                        name   = "[Simple tracker]",
                        trkseg = points.ToArray(),
                    }
                };

                string destination = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"route{i + 1}.gpx");

                XmlWriterSettings settings = new XmlWriterSettings()
                {
                    Indent          = true,
                    NewLineHandling = NewLineHandling.Replace
                };


                //using XmlWriter writer = XmlWriter.Create(destination, new XmlWriterSettings());
                new XmlSerializer(exportdata.GetType())
                .Serialize(new StreamWriter(destination), exportdata);
            }
        }
Exemple #8
0
        public override GpxModel clone()
        {
            GpxFileModel newModel = null;
            gpx          gpx      = (gpx)Gpx.Clone();

            if (gpx != null)
            {
                newModel = new GpxFileModel(null, FileName, gpx);
            }
            return(newModel);
        }
        public static void convertTcxToGpx(string fileName)
        {
            TrainingCenterDatabase tcx = TrainingCenterDatabase.Load(fileName);
            gpx gpx = GpsData.convertTcxToGpx(tcx);

            if (gpx != null)
            {
                fileName = Path.ChangeExtension(fileName, ".gpx");
                string saveFilename = getSaveName(fileName, ".converted");
                if (saveFilename != null)
                {
                    gpx.Save(saveFilename);
                }
            }
        }
        public static void convertGpxToTcx(string fileName)
        {
            gpx gpx = gpx.Load(fileName);
            TrainingCenterDatabase tcx = GpsData.convertGpxToTcx(gpx);

            if (tcx != null)
            {
                fileName = Path.ChangeExtension(fileName, ".tcx");
                string saveFilename = getSaveName(fileName, ".converted");
                if (saveFilename != null)
                {
                    tcx.Save(saveFilename);
                }
            }
        }
        public GPX10File(string filename)
        {
            try
            {
                _filename       = filename;
                _gpx10          = DeserializeGPX();
                _gpxFileDetails = new GPX10FileDetails(_gpx10);

                _routes    = GetRoutes();
                _tracks    = GetTracks();
                _waypoints = GetWayPoints();
            }
            catch (Exception)
            {
                _isFileValid = false;
            }
        }
 /// <summary>
 /// Ckecks if the given file has points in side the given radius (in m).
 /// </summary>
 /// <param name="fileName">The file to search.</param>
 /// <param name="lat0">The latitude of the center point.</param>
 /// <param name="lon0">The latitude of the center point.</param>
 /// <param name="radius">Radius in meters.</param>
 /// <param name="doTracks">Whether to look at tracks or not.</param>
 /// <param name="doWaypoints">Whether to look at waypoints or not.</param>
 /// <returns></returns>
 private bool find(string fileName, double lat0, double lon0,
                   double radius, bool doTracks, bool doWaypoints)
 {
     try {
         gpx    gpx = gpx.Load(fileName);
         double lat, lon;
         if (doTracks)
         {
             // Do the tracks
             IList <trkType> tracks = gpx.trk;
             foreach (trkType trk in tracks)
             {
                 foreach (trksegType seg in trk.trkseg)
                 {
                     foreach (wptType wpt in seg.trkpt)
                     {
                         lat = (double)wpt.lat;
                         lon = (double)wpt.lon;
                         if (GpsData.greatCircleDistance(lat0, lon0, lat, lon) <= radius)
                         {
                             return(true);
                         }
                     }
                 }
             }
         }
         if (doWaypoints)
         {
             // Do the waypoints
             IList <wptType> waypoints = gpx.wpt;
             foreach (wptType wpt in waypoints)
             {
                 lat = (double)wpt.lat;
                 lon = (double)wpt.lon;
                 if (GpsData.greatCircleDistance(lat0, lon0, lat, lon) <= radius)
                 {
                     return(true);
                 }
             }
         }
     } catch (Exception) {
         return(false);
     }
     return(false);
 }
Exemple #13
0
        private gpx GetGpxXml(IEnumerable <GeoPointDTO> geoPointDTOs)
        {
            var gpxItem = new gpx();

            gpxItem.trk = new gpxTrk();

            var list = new List <gpxTrkTrkpt>();

            foreach (var geoPoint in geoPointDTOs)
            {
                var pt = new gpxTrkTrkpt();
                pt.lat = geoPoint.latitude;
                pt.lon = geoPoint.longitude;

                list.Add(pt);
            }

            gpxItem.trk.trkseg = list.ToArray();
            return(gpxItem);
        }
Exemple #14
0
 public GPX10FileDetails(gpx gpx10)
 {
     _gpxType = gpx10;
 }
Exemple #15
0
 private void ReadGpxv1_0(gpx gpx)
 {
     this.FeatureCollection.Clear();
     if (gpx.wpt != null)
     {
         foreach (gpxWpt gpxWpt in gpx.wpt)
         {
             Feature feature = new Feature((Geometry) new Point(new GeoCoordinate((double)gpxWpt.lat, (double)gpxWpt.lon)));
             if (gpxWpt.ageofdgpsdataSpecified)
             {
                 feature.Attributes.Add("ageofdgpsdata", (object)gpxWpt.ageofdgpsdata);
             }
             if (gpxWpt.eleSpecified)
             {
                 feature.Attributes.Add("ele", (object)gpxWpt.ele);
             }
             if (gpxWpt.fixSpecified)
             {
                 feature.Attributes.Add("fix", (object)gpxWpt.fix);
             }
             if (gpxWpt.geoidheightSpecified)
             {
                 feature.Attributes.Add("geoidheight", (object)gpxWpt.geoidheight);
             }
             if (gpxWpt.hdopSpecified)
             {
                 feature.Attributes.Add("hdop", (object)gpxWpt.hdop);
             }
             if (gpxWpt.magvarSpecified)
             {
                 feature.Attributes.Add("magvar", (object)gpxWpt.magvar);
             }
             if (gpxWpt.pdopSpecified)
             {
                 feature.Attributes.Add("pdop", (object)gpxWpt.pdop);
             }
             if (gpxWpt.timeSpecified)
             {
                 feature.Attributes.Add("time", (object)gpxWpt.time);
             }
             if (gpxWpt.vdopSpecified)
             {
                 feature.Attributes.Add("vdop", (object)gpxWpt.vdop);
             }
             if (gpxWpt.Any != null)
             {
                 feature.Attributes.Add("Any", (object)gpxWpt.Any);
             }
             if (gpxWpt.cmt != null)
             {
                 feature.Attributes.Add("cmt", (object)gpxWpt.cmt);
             }
             if (gpxWpt.desc != null)
             {
                 feature.Attributes.Add("desc", (object)gpxWpt.desc);
             }
             if (gpxWpt.dgpsid != null)
             {
                 feature.Attributes.Add("dgpsid", (object)gpxWpt.dgpsid);
             }
             if (gpxWpt.name != null)
             {
                 feature.Attributes.Add("name", (object)gpxWpt.name);
             }
             if (gpxWpt.sat != null)
             {
                 feature.Attributes.Add("sat", (object)gpxWpt.sat);
             }
             if (gpxWpt.src != null)
             {
                 feature.Attributes.Add("src", (object)gpxWpt.src);
             }
             if (gpxWpt.sym != null)
             {
                 feature.Attributes.Add("sym", (object)gpxWpt.sym);
             }
             if (gpxWpt.url != null)
             {
                 feature.Attributes.Add("url", (object)gpxWpt.url);
             }
             if (gpxWpt.urlname != null)
             {
                 feature.Attributes.Add("urlname", (object)gpxWpt.urlname);
             }
             if (gpxWpt.type != null)
             {
                 feature.Attributes.Add("type", (object)gpxWpt.type);
             }
             this.FeatureCollection.Add(feature);
         }
     }
     if (gpx.rte != null)
     {
         foreach (gpxRte gpxRte in gpx.rte)
         {
             List <GeoCoordinate> geoCoordinateList = new List <GeoCoordinate>();
             foreach (gpxRteRtept gpxRteRtept in gpxRte.rtept)
             {
                 GeoCoordinate coordinate = new GeoCoordinate((double)gpxRteRtept.lat, (double)gpxRteRtept.lon);
                 geoCoordinateList.Add(coordinate);
                 if (this._createTrackPoints)
                 {
                     Feature feature = new Feature((Geometry) new Point(coordinate));
                     if (gpxRteRtept.ageofdgpsdataSpecified)
                     {
                         feature.Attributes.Add("ageofdgpsdata", (object)gpxRteRtept.ageofdgpsdata);
                     }
                     if (gpxRteRtept.eleSpecified)
                     {
                         feature.Attributes.Add("ele", (object)gpxRteRtept.ele);
                     }
                     if (gpxRteRtept.fixSpecified)
                     {
                         feature.Attributes.Add("fix", (object)gpxRteRtept.fix);
                     }
                     if (gpxRteRtept.geoidheightSpecified)
                     {
                         feature.Attributes.Add("geoidheight", (object)gpxRteRtept.geoidheight);
                     }
                     if (gpxRteRtept.hdopSpecified)
                     {
                         feature.Attributes.Add("hdop", (object)gpxRteRtept.hdop);
                     }
                     if (gpxRteRtept.magvarSpecified)
                     {
                         feature.Attributes.Add("magvar", (object)gpxRteRtept.magvar);
                     }
                     if (gpxRteRtept.pdopSpecified)
                     {
                         feature.Attributes.Add("pdop", (object)gpxRteRtept.pdop);
                     }
                     if (gpxRteRtept.timeSpecified)
                     {
                         feature.Attributes.Add("time", (object)gpxRteRtept.time);
                     }
                     if (gpxRteRtept.vdopSpecified)
                     {
                         feature.Attributes.Add("vdop", (object)gpxRteRtept.vdop);
                     }
                     if (gpxRteRtept.Any != null)
                     {
                         feature.Attributes.Add("Any", (object)gpxRteRtept.Any);
                     }
                     if (gpxRteRtept.cmt != null)
                     {
                         feature.Attributes.Add("cmt", (object)gpxRteRtept.cmt);
                     }
                     if (gpxRteRtept.desc != null)
                     {
                         feature.Attributes.Add("desc", (object)gpxRteRtept.desc);
                     }
                     if (gpxRteRtept.dgpsid != null)
                     {
                         feature.Attributes.Add("dgpsid", (object)gpxRteRtept.dgpsid);
                     }
                     if (gpxRteRtept.name != null)
                     {
                         feature.Attributes.Add("name", (object)gpxRteRtept.name);
                     }
                     if (gpxRteRtept.sat != null)
                     {
                         feature.Attributes.Add("sat", (object)gpxRteRtept.sat);
                     }
                     if (gpxRteRtept.src != null)
                     {
                         feature.Attributes.Add("src", (object)gpxRteRtept.src);
                     }
                     if (gpxRteRtept.sym != null)
                     {
                         feature.Attributes.Add("sym", (object)gpxRteRtept.sym);
                     }
                     if (gpxRteRtept.url != null)
                     {
                         feature.Attributes.Add("url", (object)gpxRteRtept.url);
                     }
                     if (gpxRteRtept.urlname != null)
                     {
                         feature.Attributes.Add("urlname", (object)gpxRteRtept.urlname);
                     }
                     if (gpxRteRtept.type != null)
                     {
                         feature.Attributes.Add("type", (object)gpxRteRtept.type);
                     }
                     this.FeatureCollection.Add(feature);
                 }
             }
             Feature feature1 = new Feature((Geometry) new LineString((IEnumerable <GeoCoordinate>)geoCoordinateList));
             if (gpxRte.Any != null)
             {
                 feature1.Attributes.Add("Any", (object)gpxRte.Any);
             }
             if (gpxRte.cmt != null)
             {
                 feature1.Attributes.Add("cmt", (object)gpxRte.cmt);
             }
             if (gpxRte.desc != null)
             {
                 feature1.Attributes.Add("desc", (object)gpxRte.desc);
             }
             if (gpxRte.name != null)
             {
                 feature1.Attributes.Add("name", (object)gpxRte.name);
             }
             if (gpxRte.number != null)
             {
                 feature1.Attributes.Add("number", (object)gpxRte.number);
             }
             if (gpxRte.src != null)
             {
                 feature1.Attributes.Add("src", (object)gpxRte.src);
             }
             if (gpxRte.url != null)
             {
                 feature1.Attributes.Add("url", (object)gpxRte.url);
             }
             if (gpxRte.urlname != null)
             {
                 feature1.Attributes.Add("urlname", (object)gpxRte.urlname);
             }
             this.FeatureCollection.Add(feature1);
         }
     }
     foreach (gpxTrk gpxTrk in gpx.trk)
     {
         List <GeoCoordinate> geoCoordinateList = new List <GeoCoordinate>();
         foreach (gpxTrkTrksegTrkpt gpxTrkTrksegTrkpt in gpxTrk.trkseg)
         {
             GeoCoordinate coordinate = new GeoCoordinate((double)gpxTrkTrksegTrkpt.lat, (double)gpxTrkTrksegTrkpt.lon);
             geoCoordinateList.Add(coordinate);
             if (this._createTrackPoints)
             {
                 Feature feature = new Feature((Geometry) new Point(coordinate));
                 if (gpxTrkTrksegTrkpt.ageofdgpsdataSpecified)
                 {
                     feature.Attributes.Add("ageofdgpsdata", (object)gpxTrkTrksegTrkpt.ageofdgpsdata);
                 }
                 if (gpxTrkTrksegTrkpt.eleSpecified)
                 {
                     feature.Attributes.Add("ele", (object)gpxTrkTrksegTrkpt.ele);
                 }
                 if (gpxTrkTrksegTrkpt.fixSpecified)
                 {
                     feature.Attributes.Add("fix", (object)gpxTrkTrksegTrkpt.fix);
                 }
                 if (gpxTrkTrksegTrkpt.geoidheightSpecified)
                 {
                     feature.Attributes.Add("geoidheight", (object)gpxTrkTrksegTrkpt.geoidheight);
                 }
                 if (gpxTrkTrksegTrkpt.hdopSpecified)
                 {
                     feature.Attributes.Add("hdop", (object)gpxTrkTrksegTrkpt.hdop);
                 }
                 if (gpxTrkTrksegTrkpt.magvarSpecified)
                 {
                     feature.Attributes.Add("magvar", (object)gpxTrkTrksegTrkpt.magvar);
                 }
                 if (gpxTrkTrksegTrkpt.pdopSpecified)
                 {
                     feature.Attributes.Add("pdop", (object)gpxTrkTrksegTrkpt.pdop);
                 }
                 if (gpxTrkTrksegTrkpt.timeSpecified)
                 {
                     feature.Attributes.Add("time", (object)gpxTrkTrksegTrkpt.time);
                 }
                 if (gpxTrkTrksegTrkpt.vdopSpecified)
                 {
                     feature.Attributes.Add("vdop", (object)gpxTrkTrksegTrkpt.vdop);
                 }
                 if (gpxTrkTrksegTrkpt.Any != null)
                 {
                     feature.Attributes.Add("Any", (object)gpxTrkTrksegTrkpt.Any);
                 }
                 if (gpxTrkTrksegTrkpt.cmt != null)
                 {
                     feature.Attributes.Add("cmt", (object)gpxTrkTrksegTrkpt.cmt);
                 }
                 if (gpxTrkTrksegTrkpt.desc != null)
                 {
                     feature.Attributes.Add("desc", (object)gpxTrkTrksegTrkpt.desc);
                 }
                 if (gpxTrkTrksegTrkpt.dgpsid != null)
                 {
                     feature.Attributes.Add("dgpsid", (object)gpxTrkTrksegTrkpt.dgpsid);
                 }
                 if (gpxTrkTrksegTrkpt.name != null)
                 {
                     feature.Attributes.Add("name", (object)gpxTrkTrksegTrkpt.name);
                 }
                 if (gpxTrkTrksegTrkpt.sat != null)
                 {
                     feature.Attributes.Add("sat", (object)gpxTrkTrksegTrkpt.sat);
                 }
                 if (gpxTrkTrksegTrkpt.src != null)
                 {
                     feature.Attributes.Add("src", (object)gpxTrkTrksegTrkpt.src);
                 }
                 if (gpxTrkTrksegTrkpt.sym != null)
                 {
                     feature.Attributes.Add("sym", (object)gpxTrkTrksegTrkpt.sym);
                 }
                 if (gpxTrkTrksegTrkpt.url != null)
                 {
                     feature.Attributes.Add("url", (object)gpxTrkTrksegTrkpt.url);
                 }
                 if (gpxTrkTrksegTrkpt.urlname != null)
                 {
                     feature.Attributes.Add("urlname", (object)gpxTrkTrksegTrkpt.urlname);
                 }
                 if (gpxTrkTrksegTrkpt.type != null)
                 {
                     feature.Attributes.Add("type", (object)gpxTrkTrksegTrkpt.type);
                 }
                 this.FeatureCollection.Add(feature);
             }
         }
         Feature feature1 = new Feature((Geometry) new LineString((IEnumerable <GeoCoordinate>)geoCoordinateList));
         if (gpxTrk.Any != null)
         {
             feature1.Attributes.Add("Any", (object)gpxTrk.Any);
         }
         if (gpxTrk.cmt != null)
         {
             feature1.Attributes.Add("cmt", (object)gpxTrk.cmt);
         }
         if (gpxTrk.desc != null)
         {
             feature1.Attributes.Add("desc", (object)gpxTrk.desc);
         }
         if (gpxTrk.name != null)
         {
             feature1.Attributes.Add("name", (object)gpxTrk.name);
         }
         if (gpxTrk.number != null)
         {
             feature1.Attributes.Add("number", (object)gpxTrk.number);
         }
         if (gpxTrk.src != null)
         {
             feature1.Attributes.Add("src", (object)gpxTrk.src);
         }
         if (gpxTrk.url != null)
         {
             feature1.Attributes.Add("url", (object)gpxTrk.url);
         }
         if (gpxTrk.urlname != null)
         {
             feature1.Attributes.Add("urlname", (object)gpxTrk.urlname);
         }
         this.FeatureCollection.Add(feature1);
     }
 }