ycdev/php-osm-static-aero 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ycdev/php-osm-static-aero

Composer 安装命令:

composer require ycdev/php-osm-static-aero

包简介

PHP library to generate static aeronautical maps from OpenStreetMap (OSM) with markers, lines and drawings.

README 文档

README

GitHub license

PHP OSM Static Aero

PHP library to generate static aeronautical maps from OpenStreetMap with markers, lines, circles and polygons.

This project is a fork of php-osm-static-api by Franck ALARY (DantSu), adapted for aeronautical paper map generation.

This project uses the Tile Server of the OpenStreetMap Foundation which runs entirely on donated resources, see Tile Usage Policy for more information.

Requirements

  • PHP >= 7.0
  • Extension gd
  • Extension curl

Installation

composer require ycdev/php-osm-static-aero

How to use

Generate OpenStreetMap static image with markers and polygon :

use \Ycdev\OsmStaticAero\OpenStreetMap;
use \Ycdev\OsmStaticAero\LatLng;
use \Ycdev\OsmStaticAero\Polygon;
use \Ycdev\OsmStaticAero\Markers;

\header('Content-type: image/png');
(new OpenStreetMap(new LatLng(44.351933, 2.568113), 17, 600, 400))
    ->addMarkers(
        (new Markers(__DIR__ . '/resources/marker.png'))
            ->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
            ->addMarker(new LatLng(44.351933, 2.568113))
            ->addMarker(new LatLng(44.351510, 2.570020))
            ->addMarker(new LatLng(44.351873, 2.566250))
    )
    ->addDraw(
        (new Polygon('FF0000', 2, 'FF0000DD'))
            ->addPoint(new LatLng(44.351172, 2.571092))
            ->addPoint(new LatLng(44.352097, 2.570045))
            ->addPoint(new LatLng(44.352665, 2.568107))
            ->addPoint(new LatLng(44.352887, 2.566503))
            ->addPoint(new LatLng(44.352806, 2.565972))
            ->addPoint(new LatLng(44.351517, 2.565672))
    )
    ->getImage()
    ->displayPNG();

Align and zoom the map to drawings and markers :

  • ->fitToDraws(int $padding = 0)
  • ->fitToMarkers(int $padding = 0)
  • ->fitToMarkersAndDraws(int $padding = 0)
  • ->fitToPoints(LatLng[] $points, int $padding = 0)

$padding sets the amount of padding in the borders of the map that shouldn't be accounted for when setting the view to fit bounds. This can be positive or negative according to your needs.

Documentation

Class Description
Circle Draw circle on the map.
Geometry2D 2D geometry utility methods.
Image GD-based image editing with tile caching.
LatLng Define latitude and longitude for map, lines, markers.
Line Draw line on the map.
MapData Convert latitude and longitude to image pixel position.
Markers Display markers on the map.
OpenStreetMap Main class to generate static map images.
Polygon Draw polygon on the map.
TileLayer Define tile server url and related configuration.
XY Define X and Y pixel position for map, lines, markers.

Credits

This project is based on php-osm-static-api originally created by Franck ALARY (DantSu), licensed under the MIT License.

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 23
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固