I'm using / to generate some random user data for testing. I'd like to geocode the latitude and longitude that provides to attach the real city/state/country information instead of the totally fake info that RandomUser provides. However, many of the actual lat/long values on these objects turn out to be in the middle of the ocean.
Is there an API, or some other method, that will let me get random coordinates which are always over land? I've seen this: Random geographic coordinates (on land, avoid ocean) But surely there must be some more efficient way than to just guess-and-check with constant geocoding until you find one that works, right?
I'm using https://randomuser.me/ to generate some random user data for testing. I'd like to geocode the latitude and longitude that provides to attach the real city/state/country information instead of the totally fake info that RandomUser provides. However, many of the actual lat/long values on these objects turn out to be in the middle of the ocean.
Is there an API, or some other method, that will let me get random coordinates which are always over land? I've seen this: Random geographic coordinates (on land, avoid ocean) But surely there must be some more efficient way than to just guess-and-check with constant geocoding until you find one that works, right?
https://3geonames/ Click on "Pick a random location at or near land"
The API is here: https://api.3geonames/?randomland=yes (for a random location on land)
or https://api.3geonames/?random=yes for any other kind of random location.
Update: As of September 2020 you can pick a random location in any given country. For example https://3geonames/randomland.NL will return a random location in the Netherlands.
For what is worth, there exists an open source library called OpenAddresses that can be used for your exact purpose as well as all kinds of purposes. I'm using it in several projects.
Using Javascript fetch
fetch('https://batch.openaddresses.io/api/data', {
method: 'GET',
withCredentials: true,
credentials: 'include',
headers: {
'Authorization': 'oa.1234-your-token-here-5678',
'Content-Type': 'application/json'
}
});
With the list data function you can get the latest successful run of a given geographic area of your liking.