I have a project in PHP and I'm using openlayers for maps, but I need to locate bookmarks by passing a list of addresses, it has to be a free geocoder since there are many addresses. Thank you very much.
For geocoding your place adress for free, use nominatim.openstreetmap.org geocoder with jquery ajax this way :
var data = {
"format": "json",
"addressdetails": 1,
"q": "22 rue mouneyra bordeaux",
"limit": 1
};
$.ajax({
method: "GET",
url: "https://nominatim.openstreetmap.org",
data: data
})
.done(function( msg ) {
console.log( msg );
});
You will receive a yummy json object :
address: {
city: "Bordeaux"
country: "France"
country_code: "fr"
county: "Bordeaux"
house_number: "22"
postcode: "33000"
road: "Rue Mouneyra"
state: "Nouvelle-Aquitaine"
suburb: "Saint-Augustin - Tauzin - Alphonse Dupeux"
}
boundingbox:["44.8341251", "44.8342251", "-0.581869", "-0.581769"]
class: "place"
display_name: "22, Rue Mouneyra, Saint-Augustin - Tauzin - Alphonse Dupeux, Bordeaux, Gironde, Nouvelle-Aquitaine, France métropolitaine, 33000, France"
importance: 0.411
lat: "44.8341751"
licence: "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
lon: "-0.581819"
osm_id: "2542169758"
osm_type: "node"
place_id: "26453710"
type: "house"
You can then geocode multiple places in a loop.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With