Reverse GeoCoding with WebClient : does it work ?

  • Thread starter Thread starter MarcoGG
  • Start date Start date
M

MarcoGG

Guest
Hi,

I have as input a simple Decimal Gps Lat/Lon point : let's say 40.766201, -73.977547.

I make a simple request on a free reverse geocoding app like this :

https://nominatim.openstreetmap.org...66201&lon=-73.977547&zoom=18&addressdetails=1
Browser's response is a simple xml like this :


<reversegeocode timestamp="Fri, 14 Feb 20 08:55:13 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. OpenStreetMap" querystring="format=xml&lat=40.766201&lon=-73.977547&zoom=18&addressdetails=1">
<result place_id="150418826" osm_type="way" osm_id="265147718" lat="40.765983399999996" lon="-73.97757174590839" boundingbox="40.7658422,40.7661164,-73.977763,-73.9774029">
128, Central Park South, Columbus Circle, Manhattan Community Board 5, Manhattan, New York County, New York, 10019, Stati Uniti d'America
</result>
<addressparts>
<house_number>128</house_number>
<road>Central Park South</road>
<suburb>Manhattan</suburb>
<city>New York</city>
<county>New York County</county>
<state>New York</state>
<postcode>10019</postcode>
<country>Stati Uniti d'America</country>
<country_code>us</country_code>
</addressparts>
</reversegeocode>

Which is what I need, and in particular Country / City / Road / House_Number.

Now, on the Application side, I use a WebClient Object to obtain the same string :


Dim WC As New System.Net.WebClient
WC.Encoding = System.Text.Encoding.UTF8
Dim wcRequest As String = "https://nominatim.openstreetmap.org...66201&lon=-73.977547&zoom=18&addressdetails=1"
Dim wcResult As String = WC.DownloadString(wcRequest)

I always get Error WebException on WC.DownloadString() Method as "Remote Server Error (403) Not Allowed".

Allowed using a browser and not allowed using code ? What's wrong ?

Thanks to anyone able to help...

Continue reading...
 
Back
Top