City : Lincolnshire State : IL Country : United States Zip : 60069

For the above mentioned location, the coordinates that we are getting from the API are [-100.4458825,39.7837304] which seems to be wrong as the correct coordinates are [-89.4337288, 40.0796606]. Because of the wrong coordinates from the API, Illinois is getting mapped in the center instead of towards right.

Can someone help me with this?

asked 27 May, 08:46

Rayana%20padmini's gravatar image

Rayana padmini
accept rate: 0%

edited 14 Jun, 10:13

TZorn's gravatar image



What API? What call are you making? What are you using it for?

(27 May, 11:18) Richard ♦ the above is the URL we are calling to get the coordinates

(27 May, 11:42) Rayana padmini

What exact call are you making?

(27 May, 12:21) Richard ♦

hm. Neither of the above coordinates point to Lincolnshire, IL 60069. It's around [-87.9,42.2]. I wonder if you are doing something fundamentally wrong or are using a different coordinate system.

(27 May, 16:02) TZorn

I found the issue as the responses from the web api and html request of same api from java code are totally different but really don't know why. Can some one help me with this.

(12 Jun, 10:48) Saicheedepudi

Please tell us which exact URL you are calling (including all parameters). And please describe "totally different". The result depends on the parameters you are submitting. Some of those parameters are contained in the HTTP request, for example the Accept-Language header. These may vary between browser requests and requests from within your Java application.

(12 Jun, 12:00) scai ♦

I think the query you posted above only searches for "IL", not for "Lincolnshire, IL" (typo?)

(13 Jun, 04:28) escada

I was checking for coordinates for IL,United States. The coordinates must be "lat":"40.0796606","lon":"-89.4337288". This was getting in the web api. But when I hit through HTTP request from java, I could get some array of values which contain places different from the response of web api.

The response from web api is

[{"place_id":197818778,"licence":"Data © OpenStreetMap contributors, ODbL 1.0.","osm_type":"relation","osm_id":122586,"boundingbox":["36.9701313","42.5082935","-91.5130518","-87.0199244"],"lat":"40.0796606","lon":"-89.4337288","display_name":"Illinois, USA","class":"boundary","type":"administrative","importance":0.876033481475436,"icon":"","address":{"state":"Illinois","country":"USA","country_code":"us"}}
(13 Jun, 11:43) Saicheedepudi

Can you explain what problem you are trying to solve?

(13 Jun, 12:55) SomeoneElse ♦

SomeoneElse +1

Your problem is not so much the coordinates but that you get different locations returned. Your "web api" call returns Illinois while your "http request from java" returns the United States. Each with the proper coordinates I expect.

You still have not told us what exact request you used for the "java code".

(13 Jun, 13:55) TZorn

The request I was using from java code is

String mapUrl=",+United+States&format=json&addressdetails=1"; URL url = new URL(mapUrl); HttpURLConnection httpConnection = (HttpURLConnection)url.openConnection();

And I have used the same url as the web api, but ended up with different results.Yes, the response from httprequest returns the USA, so the coordinates were the coordinates of centre of USA. But don't know why the problem is only with the short form IL.

(14 Jun, 06:56) Saicheedepudi
showing 5 of 13 show 8 more comments

I wonder if the Java library does somehow modify or remove the comma in the request that separates state and country. Maybe you can check in the actual http traffic. If I do the same request not including the comma I also get the USA as the first result.

I have no idea why nominatim handles the requests that different but it would be one explanation and a hint for you how to work around the problem. By escaping it somehow.

permanent link

answered 14 Jun, 10:20

TZorn's gravatar image

accept rate: 10%

edited 14 Jun, 10:20

Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 27 May, 08:46

question was seen: 290 times

last updated: 14 Jun, 10:20

powered by OSQA