Geocoding API

Easily geocode a large number of addresses throughout the world

A precise global
Roads database

One-shot or batch processing
of large volumes of addresses

Automated IRIS geocoding
of addresses (only for France).

What is geocoding?

Geocoding is the process of retrieving geographical coordinates (latitude and longitude) for your postal addresses.

For example, geocoding this address:

149 avenue du Général de Gaulle, 37230 Fondettes

Will result in:

47.396635, 0.645589

How does Articque’s geocoding API work?

Example of request and response

Based on a REST architecture, Articque’s geocoding API allows you to geocode an address through a simple url call.

Geocoding French addresses – request format for geocoding a postal address

http://geocodage.articque.com/api/france/token/address/zipcode/city
  • Token : your API key
  • Address : street number, followed by street type and street name.
  • Zipcode : 5-digit zipcode
  • City : city name

Example of geocoding request for an address: ‘12 rue nationale, 37000 Tours’.

http://geocodage.articque.com/api/france/token/12+rue+nationale/37000/tours

The response to this geocoding request is shown below, in JSON format.

{"adresse":"12+rue+nationale","code_postal":"37000","ville":"Tours","latitude":47.395949,"longitude":0.686797, "precision":"adresse","score":0.95894545454545}

The result contains geographical coordinates of the address (latitude and longitude, expressed in decimal degrees), as well as information on the accuracy of the geocoding result (‘precision’ and ‘score’).
‘Precision’ field contained in the response can provide following values, depending on the result precision:

  • ‘address’: point is geocoded to the exact address housenumber location.
  • ‘street’: point is geocoded to the street level with an interpolation.
  • ‘municipality’: point is geocoded at the centroid of the municipality.

World geocoding – request format for geocoding a postal address

http://geocodage.articque.com/api/france/token/address/zipcode/city/slate/country
  • Token : your API key
  • Address : street number, followed by street type and street name.
  • Zipcode : 5-digit zipcode
  • City : city name
  • State : the state name (example: Arizona)
  • Country : the country namee

Example of geocoding request for the address: ‘100 Aquarium Way, Long Beach, CA 90802, United States of America’.

http://geocodage.articque.com/api/france/token/100+aquarium+way/90802/Long+Beach/California/United+States+of+America

The response to this geocoding request is shown below, in JSON format.

{"adresse":"100+aquarium+way","code_postal":"90802","ville":"Long Beach","latitude":38.914036,"longitude":-77.078538, "precision":"adresse","score":0.95894545454545}

The different kinds of calls

1. Synchronous calls

The customer waits for the server response before sending the next request.
Average treatment time per address: 0.2 second.

Example of a call with a PHP script :

<?php ini_set('max_execution_time',60*10);
header( 'Content-type: text/html; charset=utf-8' );
$token = 'token’;
$baseurl = 'https://geocodage.articque.com/api/'.$token.'/';

$start = microtime(true);

$outputfilename = 'synchrone-'.date('Y-m-d H-i-s').'.csv';

$i = 0;$found = 0;
if (($handle = fopen("test_charge_100.csv", "r")) !== FALSE) {
   while (($row = fgetcsv($handle, 0, ";")) !== FALSE) {
       $i++;

       $result = json_decode(file_get_contents($baseurl.implode('/',array_map("urlencode",$row))),true);

       if(!array_key_exists('error',$result))
       {
          file_put_contents($outputfilename,implode(';',array_map("urldecode",$result))."n", FILE_APPEND);
         }

if($i%10 == 0)
       {
        echo $i.' adresses traitées -en '.(microtime(true)-$start).' secondes<br/>';
        flush();
        ob_flush();
      }

   }
   fclose($handle);
}

$duration = (microtime(true)-$start);
echo $i.' adresses traitées en '.$duration.' secondes<hr/>En moyenne par adresse : '.$duration/$i.' seconde';

ob_end_flush();
?>

2. Asynchronous calls

The customer sends several requests at the same time.
Average treatment time per address: 0.07 second.

Example of a call with a PHP script :

<?php ini_set('max_execution_time',60*10);
header( 'Content-type: text/html; charset=utf-8' );
$token = 'token’;
$baseurl = 'https://geocodage.articque.com/api/'.$token.'/';
$start = microtime(true);
$outputfilename = 'asynchrone-'.date('Y-m-d H-i-s').'.csv';
// D'abord, on récupère toutes les lignes du fichier
$rows = array_map("trim", explode("n",file_get_contents("test_charge_100.csv")));
echo 'Récupération du fichier '.(microtime(true)-$start).' seconde<br/>';
flush();
ob_flush();

/***
 * CURL MULTITHREAD
 */
$master = curl_multi_init();

// On traite les données 10 par 10
for($i=0; $i < count($rows); $i = $i + 10)
{
      $running  = null;
      $handles = array();

      $srv_alt = false;
      for($j = $i; $j < min(count($rows),$i+10); $j++)
      {
      $ch = curl_init($baseurl.implode('/',array_map("urlencode",explode(';',$rows[$j]))));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_multi_add_handle($master, $ch);
      $handles[] = $ch;
 }

echo 'Initialisation des appels de '.$i.' à '.$j.' -'.(microtime(true)-$start).' seconde<br/>';
flush();
ob_flush();

// Run the multi exec until it's over
 do
 { curl_multi_exec($master,$running);
 } while ($running > 0 );<br />
foreach($handles as $handle)<br />
{<br />
             $result = json_decode(curl_multi_getcontent($handle),true);<br />
             file_put_contents($outputfilename, implode(‘;’,array_map(« urldecode »,$result)). »n », FILE_APPEND);<br />
             curl_multi_remove_handle($master,$handle);<br />
 }</p>
<p> echo $j.’ adresses traitées -en ‘.(microtime(true)-$start).’ secondes<br/>’;<br />
 flush();<br />
 ob_flush();<br />
 }<br />
curl_multi_close($master);<br />
$duration = (microtime(true)-$start);<br />
echo $i.’ adresses traitées en ‘.$duration.’ secondes<br />
<hr/>En moyenne par adresse : ‘.$duration/$i.’ seconde’;<br />
ob_end_flush();<br />
?>

How to get an API key ?

Contact us to learn more about our APIs or to get your geocoding API key. Our prices are transparent and will yield no surprises :

Articque’s Geocoding API
990 € per year for 1 million addresses


Should you need to geocode 20 million addresses,

we also have a solution for you. Contact us!