承接 cyrille37/yapafo 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

cyrille37/yapafo

最新稳定版本:v2.3.3

Composer 安装命令:

composer require cyrille37/yapafo

包简介

Manipulate OpenStreetMap Data via OSM & Overpass APIs.

README 文档

README

yapafo is a library which permits to authenticate, read and write objects in the OpenStreetMap database.

It's not an user friendly App but a tool for processing OSM data ;-)

FEATURES

  • Read (query) objects from API, XAPI and Overpass.
  • Write (create, update, delete) objects on API.
  • Authenticate with Basic or OAuth 2.
  • Class for osm objects are serializable.
  • A bit of geometry stuff are available locally (on query result)
    • is node inside/outside polygon
    • get gravity center for relation or way
  • it's for developer, so by default debug is on, it use test API endpoint
  • ...

Installation

  • install dependencies
    • composer install

The configuration

By default:

  • API operations are done on Osm developement instance at master.apis.dev.openstreetmap.org ;
    • Write operations are carried out in "simulation" mode, so that no queries are made.
  • Overpass queries are done on overpass-api.de ;
  • XAPI queries are done on overpass-api.de ;
  • Print some tech message because logger level is Notice.

To overide those default behaviors, create file .env and set

  • simulation = false to really write on API
  • osm_api_url = https://api.openstreetmap.org/api/0.6 to query and update on production OSM instance

When developing

  • you can avoid repetitive call to services by activatin the cache
    • osm_api_cacheFolder = a_folder
  • you can store in file each out/in from services
    • outputFolder = a_folder

Read .env.example to know more about configuration.

Generate an Access Token

The command-line ./vendor/bin/oauth-console.php will drive you on getting an OAuth2 Access Token, launch it and read the instructions.

The process consists of several stages:

  1. choose the OSM server instance
  2. choose the permissions you need
  3. enter Application ID and Secret
  • if you have to create an Application
  • visit <the instance you choose>/oauth2/applications/
  • create a new Application
    • with redirect to urn:ietf:wg:oauth:2.0:oob
    • and needed scopes
    • I don't know about 'confidential' option
  1. get an authorization code
  2. finally, get the precious Access Token you need to access some services as an authenticated user.

To facilitate the procedure for obtaining the token, a Web page is currently under construction at examples-web/OAuthRequestAccess.php

Tuto and examples

examples-console

Look at the code to learn more abour Yapafo.

examples-web

Work in progress

BUG and Discussions

REQUIREMENTS

Requirements are covered by composer.json.

Php >=7.4 et <8.3.

Php extensions:

Php libraries:

References

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-10-26