It’s written PHP and uses the Geonames geocoding service. It tries to cache geocode results in an SQLite database.
It’s stupidly simple, with a single optional parameter in the constructor and a single public method.
The parameter is an optional path to specify a location for an SQLite database.
The method is called “geocode” and takes an array of place names. It returns an array of GeoJSON Features which you can create FeatureClasses with, or use however you want.
It’s a piece of larger project I’m working on, but seemed semi-useful on its own.
Here’s an example of using it to create a feature class out of several places names in an array:
<?php $places = Array( 'Ironwood, MI, USA', 'Sacramento, MG, Brazil', 'Provo', 'Lostlandneverfoundcity' ); require_once('ssgeocoder.php'); $ssgeocoder = new ssgeocoder(); $features = $ssgeocoder->geocode($places); $geojson = Array( 'type' => 'FeatureCollection', 'features' => $features ); print json_encode($geojson);
Not too bad, right? You’ll see this used again in a couple of other projects I’m working on.