error acedss denied reverse geocode
Code:
Sub Getadress()
Dim myURL As String
Dim lat As String
Dim lon As String
Dim txt As String, test As String
lat = "40.848641"
lon = "14.225083"
myURL = "http://nominatim.openstreetmap.org/reverse?format=xml&lat=" & lat & "&lon=" & lon & "&addressdetails=1"
Debug.Print myURL
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.send<<<<<<<<<<<<<error here
If WinHttpReq.Status = 200 Then
txt = WinHttpReq.responseText
test = getfield(txt, "road") & getfield(txt, "postcode") & getfield(txt, "village") & getfield(txt, "country")
Debug.Print test
End If
End Sub
Re: error acedss denied reverse geocode
Maybe you are blocked because of to many requests?
https://operations.osmfoundation.org...ies/nominatim/
Google AI answer:
Getting an access denied (403 Forbidden) error on nominatim.openstreetmap.org means your IP or application was blocked, usually for violating the free usage policy. The public, volunteer-run server strictly prohibits auto-complete (on-type) searching, bulk geocoding, and requires a valid User-Agent.
Why You Were Blocked
- Missing/Generic User-Agent: Requests without a custom User-Agent (or using generic strings like python-requests or axios) are immediately rejected.
- Auto-Complete/Typing Requests: Firing a query for every keystroke is strictly forbidden.
- Overuse: The public endpoint caps limits at 1 request per second. Bulk data processing or exceeding this speed will trigger a block.
How to Fix & Unblock Access
Blocks placed on the public server typically clear automatically within a few hours to 24 hours. To resume access, you must follow the Nominatim Usage Policy:
- Set a Custom User-Agent: You must identify your application. Include your app name and a valid contact email in the request header (e.g., MyApp/1.0 ([email protected])).
- Throttle Your Requests: Ensure your system pauses for at least 1 second between requests.
- Cache Results: Save geocoded coordinates in your local database so you don't repeatedly query for the same address.
Production & Bulk Alternatives
The nominatim.openstreetmap.org server is only meant for light development and testing. If you are building a commercial application, handling high-volume queries, or deploying a live website, you must switch to a production-ready alternative:
- Commercial Geocoders: Use a hosted provider like LocationIQ, Geocodio, or TomTom.
- Self-Hosting: Deploy your own instance of Nominatim using Docker and your own OpenStreetMap planet extract for unlimited, high-speed geocoding.