PHPackages                             linkeddatacenter/geocodit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. linkeddatacenter/geocodit

AbandonedArchivedLibrary[API Development](/categories/api)

linkeddatacenter/geocodit
=========================

RESTful APIs for geocodit

1.1.2(10y ago)3271[3 issues](https://github.com/linkeddatacenter/geocodit/issues)MITPHPPHP &gt;=5.5.0

Since Feb 23Pushed 7y ago3 watchersCompare

[ Source](https://github.com/linkeddatacenter/geocodit)[ Packagist](https://packagist.org/packages/linkeddatacenter/geocodit)[ Docs](https://github.com/linkeddatacenter)[ RSS](/packages/linkeddatacenter-geocodit/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

GeocodIT project
================

[](#geocodit-project)

[![Latest Version](https://camo.githubusercontent.com/9e2096338ecb908983f650bcd2b04de239dc5095abaa15f82f96b53de52d8d7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c696e6b65646461746163656e7465722f67656f636f6469742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/linkeddatacenter/geocodit)

\*\*WARNING: this project now is under refactory \*\*

GeocodIT is a system that manages a [geocoding](https://en.wikipedia.org/wiki/Geocoding) knowledge base using W3C semantic web best practices and standards.

Data sets on the web are literary exploding. Of course they’re still fragmented and of different quality but that will be fixed and it is only a matter of time. With Linked Open Data, it does not make sense to use only the biggest dataset (i.e. Open Street Map, &amp; Google Maps) because the highest quality data are often in the smallest ones. These are in the long tail of the web. Hence you’ve to use them or you’ll lose a lot of value.

GeocodIT exposes:

- a new geocoder that leverages open data to enrich the results of existing geocoding services (e.g. Google Maps Bings Maps and OSM);
- a tool to compare the results and performances of various geocoders;
- a language profile (ontologies) to be used to describe geocoding data in RDF;
- a set of gateways to transform 3 stars linked data into five stars linked data accordingly to GeocodIT language profile;
- a shareable knowledge base description to be used to populate a graph database with all needed geocoding information (LinkedData.Center ingestion APIs required).

GeocodIT was designed for the italian territory but can be easily adapted to other geographies.

For more about GeocodIT project see [this article](http://linkeddata.center/help/business/cases/geocodit-v1)

Demo
----

[](#demo)

A running demo is available at  . Please use this server just as a demo and learning resource. To avoid abuses, a performance penality of 2 sec. is added to each geocoder API call.

How it works
------------

[](#how-it-works)

GeocodIT uses geocoder services (free and private) and open data to increase the quality of the geocoding process. For instance, it uses ISTAT open data to add codes to administrative level in Open Street Map Results.

Why it is needed
----------------

[](#why-it-is-needed)

In some circumstances, commercial global services (like Google Maps) fail to solve addresses or produce inaccurate results. This often happens for some rural and isolated places, in private industral areas and in new sites. This information is sometime available in open data but it could also be present in private owned files.

GeocodIT tries to use all these data sources to produce accurate results.

Furthermore, commercial services put lot of constraints on GeocodIT data and this limit companies to embed geolocation data in their information systems.

Requirements
------------

[](#requirements)

GeocodIT requires:

- a [LinkedData.Center](http://LinkedData.Center/) account ([free plans available](http://linkeddata.center/home/pricing#cta)). For testing purposes a limited prepoulated knowledge base is available at  (username: demo password: demo) Note that the demo kb is "read only" (i.e. you are not enabled to change existing configuration);
- optional Google Maps API key if you need Google Maps integration;
- optional Bing Maps API key if you need Bing Maps integration.

GeocodIT is a set of web services developed in PHP and tested for ubuntu LTS 14.04 but nothing prevents it to work on any PHP5+apache2 platform (no MySQL needed!). Even apache2 is not a strong requirement; with few changes (mainly to web/.httpcaccess file) it should work with any php-enabled web server.

Install
-------

[](#install)

### APIs installation

[](#apis-installation)

- Create and Login to a fresh ubuntu box (physical or virtual) ;
- clone GeocodIT project in /opt/geocodit : `sudo cd /opt; git clone https://github.com/linkeddatacenter/geocodit.git`;
- execute the install script `sudo /opt/gecodit/test/_support/install.sh`;
- copy the config/geocodit.ini.dist file into geocodit.ini and add your credentials. Be sure that geocodit.it is readable to the web server (i.e. www-data user).

**IMPORTANT: GeocodIT uses your keys to access payed services, if you put it in a public server, consider to limit APIs access by configuring your web server. The default configuration allows free access to all APIS but inserts a penality of 2 seconds to each api call to discurage abuse.**

### Knowledge base population

[](#knowledge-base-population)

The demo knowledge base is pre-populated, use these instructions to create your own knowledge base:

- add the following line to your LinkedData.Center graph db instance: ```
    [] kees:includes  .

    ```
- Refresh the knowledge base (i.e. create a new ingestion activity). Most of the resources contained in the knowledge base are quite static (territory does not change so frequently).

Usage
-----

[](#usage)

GeocodIT can be used in different ways:

- use the geocoder API like you should do with Google Maps API or Openstreet map. GeocodIT geocoder is a RESTful web service that supports http content negotiation for all main GeocodIT formats. **GeocodIT is able to play along with your trust in all geocoder algoritms** allowing you to choose your preferred trust profile (e.g. open data, google, microsoft, etc.);
- use GeocodIT benchmark to get an idea of how different geocoders perform;
- query the knowledge base and import geocoding raw data in your systems;
- use the provided gateways to transform 3 stars open data in 5 stars full flagged Linked Open Data;
- use it as a composer library to build your own service;

### Using data interface

[](#using-data-interface)

After data ingestion, the knowledge base data interfaces will be available at /queries (e.g. ). Just point your browser (or your http client) to the desidered table (e.g ) and provide your LinkedData.Center credential as basic http authentication. Data interface supports content negotiation. Of course you can access SPARQL endpoint (e.g. ) fully compliant with [SPARQL 1.1 specifications](https://www.w3.org/TR/sparql11-query/) and protocol.

### Using geocoder API

[](#using-geocoder-api)

The geocoder enpoint will be available at /api/geocode (e.g. )

```
geocode?q=address[&trust=trust_profile]

```

It returns the address geolocation using a geocoding optimization.

Available trust profiles:

- **opendata** (default): search knowledge base, if address is not found, falls back on open street map enriching results with istat codes
- **ms**: try bing maps first, if no results try search KB;
- **google**: try google maps first, if no results try search KB;
- **osm**: try open street map first, if no results try search KB;
- **all**: try google maps first, then bing maps, then open street map, then if still no results try search KB.

Beside this, you can trust on result from a single provider:

- **geocodit** : just use kb data (free);
- **geocoditOSM** : openstreet map enriched with KB data (free, no more than a query per second);
- **google\_map** : google maps (requires key, license restriction on data usage);
- **bin\_map** : bing maps (requires key, license restriction on data usage);
- **openstreetmap** : open street map (free, no more than a query per second).

### Using benchmark API

[](#using-benchmark-api)

The benchmark enpoint will be available at /api/benchark (e.g. )

```
benchmark?q=address

```

It compares the result of all supported geocoders.

### Using gateways

[](#using--gateways)

The GeocodIT gateways will be available at /gw/{*gateway name*} (e.g. ).

All gateways stream a three star resource as a RDF turtle resource. Data are transformed in real time \[TBD: and cached for one day\].

Using geocodit as a library
---------------------------

[](#using-geocodit-as-a-library)

Add the following dependance to **composer.json** file in your project root:

```
    {
        "require": {
            "linkeddatacenter/geocodit": "dev-master"
        }
    }

```

GeocodIT is a companion of [Geocoder](https://github.com/geocoder-php/Geocoder).

It exposes two additional providers: geocodit and geocoditOSM, the first is a stand alone provider that uses knowledge base data for toponimy resolution, the second is an extension of openstreetmap providers that enrich the geocoder algoritm with some open data (mainly by istat).

Choose the one that fits your needs first. Let's say the `geocoditOSM` one is what you were looking for, so let's see how to use it. In the code snippet below, `curl` has been chosen as [HTTP layer](#http-adapters) but it is up to you since each HTTP-based provider implements [PSR-7](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md).

```
$curl     = new \Ivory\HttpAdapter\CurlHttpAdapter();
$geocoder = new \Geocodit\Provider\GeocoditOSM($curl,  'demo', 'demo');

$geocoder->geocode(...);
```

Extending geocodit
------------------

[](#extending-geocodit)

More or less you just have to find new data sources and design a proper ingestion policy to be added to the knowledge base configuration file. In some cases, you will have to write a gateway to transform data to RDF. Use existing gateways as a starting point. See the file \[CONTRIBUTING.md\] for some note about development environment.

License and Authors
-------------------

[](#license-and-authors)

Author: E.Fagnoni - Copyrigth: (c) 2016  The MIT License (MIT)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

5

Last Release

3699d ago

Major Versions

0.0.1 → 1.0.02016-02-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/cdabb6f1a7cc46c4a299c684f66c7e3ae2fda117fe4db45758c01fe24d66221b?d=identicon)[botk](/maintainers/botk)

---

Top Contributors

[![ecow](https://avatars.githubusercontent.com/u/5788689?v=4)](https://github.com/ecow "ecow (30 commits)")[![gwferrari](https://avatars.githubusercontent.com/u/16917304?v=4)](https://github.com/gwferrari "gwferrari (1 commits)")

### Embed Badge

![Health badge](/badges/linkeddatacenter-geocodit/health.svg)

```
[![Health](https://phpackages.com/badges/linkeddatacenter-geocodit/health.svg)](https://phpackages.com/packages/linkeddatacenter-geocodit)
```

###  Alternatives

[willdurand/geocoder-bundle

Integration of Geocoder into Symfony

3226.4M12](/packages/willdurand-geocoder-bundle)[geocoder-php/chain-provider

Geocoder chain adapter

1046.8M13](/packages/geocoder-php-chain-provider)[geocoder-php/geo-plugin-provider

Geocoder GeoPlugin adapter

975.0M8](/packages/geocoder-php-geo-plugin-provider)[geocoder-php/nominatim-provider

Geocoder Nominatim adapter

354.4M27](/packages/geocoder-php-nominatim-provider)[geocoder-php/ipstack-provider

Geocoder Ipstack adapter

60334.1k2](/packages/geocoder-php-ipstack-provider)[swisnl/geocoder-php-nationaal-georegister-provider

PDOK (formerly Nationaal Georegister) provider for Geocoder PHP

28330.8k2](/packages/swisnl-geocoder-php-nationaal-georegister-provider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
