Closed billinghamj closed 9 years ago
You can fix this by increasing the search radius
. Default is currently 100m, the max is 2000m.
https://api.postcodes.io/postcodes?lon=-2.0906458&lat=53.5642772&radius=500
You'll need to be careful when increasing the radius as this could slow down your queries in densely populated areas.
Alternatively you can use wideSearch=true
which can search up to 20km and is fast in urban areas. It uses a naive incremental search to find the nearest points. The tradeoff here is that it returns a maximum of 10 results. Check out postcodes.io/docs under reverse geocoding
If you're wondering why it's returning null
and not an empty array, this is bad design on my part. null
s will be fixed whenever there's a v2 of the API but remain for now because too many users depend on this behaviour.
Awesome, thank you :)
I've found a case where coordinates do not resolve to a postcode for some reason. I would expect it to return a postcode in the OL1 outcode:
https://api.postcodes.io/postcodes?lon=-2.0906458&lat=53.5642772
Any idea why this is happening? What could be done to fix it?
Thanks :)