NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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.

asked 20 Nov '19, 11:56

Raluca_A's gravatar image

Raluca_A
26112
accept rate: 0%

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?

(22 Nov '19, 12:39) SimonPoole ♦
2

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.

(26 Nov '19, 08:03) mtmail

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(); }

(02 Dec '19, 11:11) Raluca_A
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1
×1

question asked: 20 Nov '19, 11:56

question was seen: 912 times

last updated: 02 Dec '19, 11:11

Related questions

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum