Hello, I am trying to get Geo coordinates from a .NET Web App using HttpWebRequest and requesting this link: https://nominatim.openstreetmap.org/search?q=2+$+2A+Cyclone+Street+3995+WONTHAGGI&country=au&format=json&addressdetails=1. In my app, I receive 10 results but none of them are from Australia. If a request the same link from Postman, I receive one result from Australia. Why the difference? Should I set something specific in the web app? Thanks. |
Without the relevant code it is going to be very hard to help you with this. Are you escaping the URL properly in your app?
Unrelated to your issue: Use &countrycode=au, not &country=au. &country is part of the 'Alternative query string format' (http://nominatim.org/release-docs/latest/api/Search/) and doesn't mix well if &q is already set.
I changed &country to &countrycode. Thanks.
I can paste here the code, sure, but it's something very simple:
string osmLink = "https://nominatim.openstreetmap.org/search?q=2+$+2A+Cyclone+Street+3995+WONTHAGGI&country=au&format=json&addressdetails=1";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(osmLink); myRequest.Method = "GET"; myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
WebResponse myResponse = myRequest.GetResponse();
string responseText = string.Empty; using (var reader = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8)) { responseText = reader.ReadToEnd().Trim(); }