2017 © Pedro Peláez
 

module geonames-server

ZF2 module, index geonames data & provides a search API using Elasticsearch

image

ghislainf/geonames-server

ZF2 module, index geonames data & provides a search API using Elasticsearch

  • Tuesday, February 18, 2014
  • by ghislainf
  • Repository
  • 6 Watchers
  • 31 Stars
  • 328 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 3 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

GeonamesServer

Introduction

GeonamesServer is ZF2 module. It indexes geonames data & provides a search API using Elasticsearch.
Elasticsearch is a distributed, RESTful, open source search server based on Apache Lucene., (*1)

Demo
Composer package, (*2)

Elasticsearch index mapping

{
    "geonameid": "2988507",
    "country": "FR",
    "name": "Paris",
    "latitude": "48.85341",
    "longitude": "2.3488",
    "population": 2138551,
    "timezone": "Europe/Paris",
    "type": "city",
    "parents": [
        {
            "geonameid": "2968815",
            "name": "Paris",
            "country": "FR",
            "type": "ADM2"
        },
        {
            "geonameid": "3012874",
            "name": "Île-de-France",
            "country": "FR",
            "type": "ADM1"
        },
        {
            "geonameid": "3017382",
            "name": "France",
            "country": "FR",
            "type": "country"
        }
    ]
}

Module installation

  1. install elasticsearch
  2. cd my/project/directory
  3. create a composer.json file with following contents:, (*3)

    json { "require": { "ghislainf/geonames-server": "v0.9" } }, (*4)

  4. install composer via curl -s http://getcomposer.org/installer | php (on windows, download http://getcomposer.org/installer and execute it with PHP)
  5. run php composer.phar install
  6. open my/project/directory/configs/application.config.php and add the following key to your modules:, (*5)

    php 'GeonamesServer',, (*6)

  7. copy config/geonamesserver.local.php in my/project/directory/config/autoload
  8. edit my/project/directory/config/autoload/geonamesserver.local.php, let yourself guided by comments.
  9. import geonames data in your elasticsearch index :, (*7)

    shell $ php public/index.php geonames_install, (*8)

    Install process, (*9)

Use API

Search :

GET /geonames/_search/{string_query}
GET /geonames/_search/{string_query}/{page}
GET /geonames/_search/{string_query}/{page}/{size}, (*10)

{page} and {size} are optional, by default {page} = 1 and {size} = 10, (*11)

Get document :

GET /geonames/_get/{geonameid}
GET /geonames/_get/{geonameid},{geonameid},.., (*12)

The Versions

18/02 2014

dev-master

9999999-dev https://github.com/ghislainf/GeonamesServer

ZF2 module, index geonames data & provides a search API using Elasticsearch

  Sources   Download

MIT

The Requires

 

23/05 2013

v0.9

0.9.0.0 https://github.com/ghislainf/GeonamesServer

ZF2 module, index geonames data & provides a search API using Elasticsearch

  Sources   Download

MIT

The Requires