定制 ghislainf/geonames-server 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ghislainf/geonames-server

Composer 安装命令:

composer require ghislainf/geonames-server

包简介

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

README 文档

README

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.

Demo
Composer package

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:

    {
        "require": {
            "ghislainf/geonames-server": "v0.9"
        }
    }
  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:

    'GeonamesServer',
  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 :

    $ php public/index.php geonames_install

    Install process

Use API

Search :

GET /geonames/_search/{string_query}
GET /geonames/_search/{string_query}/{page}
GET /geonames/_search/{string_query}/{page}/{size}

{page} and {size} are optional, by default {page} = 1 and {size} = 10

Get document :

GET /geonames/_get/{geonameid}
GET /geonames/_get/{geonameid},{geonameid},..

统计信息

  • 总下载量: 343
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 32
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 31
  • Watchers: 6
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固