Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there way to do batch geocoding (get lat/lon by address and vice-versa)? [closed]

Google Geocoding API has serious limitations (2,500 requests per day) and we always get a limit error. Their business license costs $10,000 and it is too expensive for us.
Service should work with different languages and different countries.
Service should verify address and return lat/lng. The addresses could be a strings with different formats.

We are ready to pay for such service and RESTful API is preferable.

like image 570
Oleg Dats Avatar asked Apr 01 '12 00:04

Oleg Dats


People also ask

Is Google Maps reverse geocoding free?

It's free as long as you credit them and you need fewer than 15000 lookups per day. You can pay if you need more.

What is the difference between geocoding and reverse geocoding?

Reverse-Geocoding is a process used to convert coordinates (latitude and longitude) to human-readable addresses. This is not exactly the opposite of Geocoding. In Geocoding, the Place is associated with a name and fixed coordinates.


2 Answers

I worked at SmartyStreets and what you describe is their core domain.

You might be interested in LiveAddress which transforms addresses into lat/lon and can process thousands of requests per second. It's geo-distributed across 3 data centers and has a RESTful endpoint. You can do up to 100 addresses per request. There's also a list processing version if you have an Excel or CSV file or something like that.

The highest price tag is $10k, but it gives you unlimited lookups for a year.

Some sample code is at https://github.com/smartystreets/LiveAddressSamples.

Their license agreement has no such restrictions to limit your usage. Dbaseman is right: you're getting limit errors because it's a violation of the TOS (unless you get a business license from them, but even then the addresses are "best guess" -- not standardized and verified like with a CASS-Certified service. That's something to keep in mind).

like image 78
Matt Avatar answered Sep 20 '22 15:09

Matt


Have you looked into Nominatim? You can roll your own over OpenStreetMaps data, or you can send requests to OpenStreetMaps or MapQuest. Possible downsides include the CC license (requires attribution, may or may not be a problem for you) and the verification issue (data is almost entirely crowdsourced, so inaccuracies do happen). Upsides include less restrictive usage policy, frequent updates, worldwide coverage, and of course, you can't beat the price.

See https://jsfiddle.net/4hzzrws5/

var Data =[
{address: "17 rue de l'Abreuvoir. Nantilly. 28260 La Chaussée d'Ivry"},
{address: "52 rue Ernestine 95100 Argenteuil"},
{address: "3 allée Baudelaire 59139 Wattignies"},
{address: "165, Petit chemin d'aix   13320  Bouc Bel Air"},
{address: "54 avenue Yolande d'Aragon 49100 ANGERS"},
{address: "John Doe, Le Rouho Guidel 56520"},
{address: "51100"},
{address: "21 rue du Docteur Gallet - 74000 Annecy"},
{address: "4 Impasse des Cigales, 26500 Bourg lès Valence"},
{address: "83140 SIX FOURS LES PLAGES"},
{address: "35 cours Vitton 69006 Lyon"},
{address: "7 rue lallier 75009"},
{address: "Paul Michel, Villa Pétricciù,Ghjassu Pétricciù, 20221.CERVIONE"}
]

var cityAndCountry = function(res){
  var osmObj= res[0].address,
      city=osmObj.town || osmObj.city || osmObj.county || '',
      country=osmObj.country || '',
      iso2 =osmObj.country_code || '';
  var out = [ city, country, iso2];
  return out
}
var latAndLon = function(res){
  var lat= res[0].lat,
  		lon= res[0].lon;
  var out = [lat,lon];
  return out
}

var queryOsm = function(url) {
  $.getJSON(url, function (data) { 
    data.length==0? 
      console.log(["","",""],data)
    	:console.log(cityAndCountry(data),latAndLon(data),data);
  });
}

var delayedPing = function (i,data) {
  // console.log(i, data.length)
  var d = data[data.length-i];
  if(d.address){ 
  	// placeAddressOnMap(gc, d.address, d.service||"", d.customer||"")
    var url = 'https://nominatim.openstreetmap.org/search/'+d.address+'?format=json&addressdetails=1&limit=1';
    queryOsm(url)
  } else { console.log(["","","",d.address]) }
  var delay = 1000+200*Math.random();
  if (--i > 0) { setTimeout(function () { delayedPing(i,data); }, delay); }
}

delayedPing(Data.length,Data);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
like image 24
Cameron Avatar answered Sep 23 '22 15:09

Cameron