/// <summary> /// Returns the way with the given id. /// </summary> /// <param name="id"></param> /// <returns></returns> public Way WayGet(long id) { string response = this.DoApiCall(false, string.Format( "/api/0.6/way/{0}", id), Method.GET, null); if (response != null && response.Trim().Length > 0) { XmlReaderSource xml_source = new XmlReaderSource(XmlReader.Create(new StringReader(response))); OsmDocument osm = new OsmDocument(xml_source); Osm.Xml.v0_6.way xml_way = (osm.Osm as OsmSharp.Osm.Xml.v0_6.osm).way[0]; return(this.Convertv6XmlWay(xml_way)); } return(null); }
internal static Way ConvertToSimple(Osm.Xml.v0_6.way wa) { Way way = new Way(); // set id if (wa.idSpecified) { way.Id = wa.id; } // set changeset. if (wa.changesetSpecified) { way.ChangeSetId = wa.changeset; } // set visible. if (wa.visibleSpecified) { way.Visible = wa.visible; } else { // if visible is not specified it is default true. way.Visible = true; } // set timestamp. if (wa.timestampSpecified) { way.TimeStamp = wa.timestamp; } // set uid if (wa.uidSpecified) { way.UserId = wa.uid; } // set version if (wa.versionSpecified) { way.Version = wa.version; } // set user way.UserName = wa.user; // set tags. way.Tags = XmlSimpleConverter.ConvertToTags(wa.tag); // set nodes. if (wa.nd != null && wa.nd.Length > 0) { way.Nodes = new List <long>(); for (int idx = 0; idx < wa.nd.Length; idx++) { way.Nodes.Add(wa.nd[idx].@ref); } } return(way); }