public OSMInterface(string path, double scale, double tolerance, double curveTolerance, double tiles) { this.tolerance = tolerance; this.curveError = curveTolerance; mapping = new RoadMapping(tiles); fc = new FitCurves(); var serializer = new XmlSerializer(typeof(osm)); var reader = new StreamReader(path); var osm = (osm)serializer.Deserialize(reader); reader.Dispose(); Init(osm, scale); }
public OSMInterface(osmBounds bounds, double scale, double tolerance, double curveTolerance, double tiles) { this.tolerance = tolerance; this.curveError = curveTolerance; mapping = new RoadMapping(tiles); fc = new FitCurves(); var client = new WebClient(); var response = client.DownloadData("http://www.overpass-api.de/api/xapi?map?bbox=" + string.Format("{0},{1},{2},{3}", bounds.minlon.ToString(), bounds.minlat.ToString(), bounds.maxlon.ToString(), bounds.maxlat.ToString())); var ms = new MemoryStream(response); var reader = new StreamReader(ms); var serializer = new XmlSerializer(typeof(osm)); var osm = (osm)serializer.Deserialize(reader); ms.Dispose(); reader.Dispose(); osm.bounds = bounds; Init(osm, scale); }