ycdev/php-osm-static-aero

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

Maintainers

Package info

github.com/Cym-Developpement/php-osm-static-aero

Homepage

pkg:composer/ycdev/php-osm-static-aero

Fund package maintenance!

DantSu

Statistics

Installs: 12

Dependents: 0

Suggesters: 0

Stars: 0

dev-master 2026-03-16 10:33 UTC

This package is auto-updated.

Last update: 2026-03-16 10:31:46 UTC


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.