Home > Mobile >  Read Open Street Map xml response
Read Open Street Map xml response

Time:10-10

Trying to read data from Open Street Map webpage. I have Longitude and Latitude. Based on these web link is generated.

Let's say output is: enter image description here

My target is to parse xml:

  // Loading from a file, you can also load from a stream
  XDocument xml = XDocument.Parse(result);

  // Query the data and write out a subset of contacts
  IEnumerable<string> query = from c in xml.Root.Descendants("addressparts")
              select c.Element("road").Value   " "  
                     c.Element("house_number").Value;

CodePudding user response:

You'll have to provide a valid user-agent in your requests, otherwise the requests will be blocked. From the current Nominatim Usage Policy:

  • Provide a valid HTTP Referer or User-Agent identifying the application (stock User-Agents as set by http libraries will not do).
myRequest.UserAgent = "MyApp Version 1.2.3.4"
  • Related