flowaxy/geomap
最新稳定版本:v1.0.0
Composer 安装命令:
composer require flowaxy/geomap
包简介
An SVG map generator from GeoJSON for Flowaxy projects.
README 文档
README
GeoMapSvgGenerator is a PHP class for generating interactive SVG maps from GeoJSON data.
It supports region tooltips, customizable dimensions, and custom markers (icons, counts, etc).
Features
- Convert GeoJSON to interactive SVG maps
- Render regions with optional tooltips
- Add markers with icons, labels, or counts
- Control output size and language for region names
Installation
Use Composer to install the library:
composer require flowaxy/geomap
Usage
use Flowaxy\GeoMapSvgGenerator; $geojson = 'ukraine.geojson'; $markers = [ ['lat' => 50.45, 'lng' => 30.52, 'type' => 'capital', 'icon' => '⭐', 'name' => 'Kyiv'], ]; $generator = new GeoMapSvgGenerator($geojson, $markers, 1000, 800, true, 'uk'); $svg = $generator->generateSvg(); file_put_contents('map.svg', $svg);
Marker Format
Each marker may contain:
lat(float): Latitudelng(float): Longitudetype(string): Marker type (used as CSS class)icon(string): Emoji or symbol instead of circlecount(int): Number shown belowlabel(string): Text labelname(string): Tooltip text
Getting GeoJSON files
You can download GeoJSON files for countries, regions, or the entire world from:
- https://geojson-maps.ash.ms
- https://datahub.io/core/geo-countries
- https://github.com/datasets/geo-countries
- https://github.com/deldersveld/topojson (convert TopoJSON to GeoJSON using tools like https://mapshaper.org/)
For Ukraine specifically, you can try:
- https://github.com/flowaxy/GeoJSON/blob/main/countries/ukraine.geojson
- https://mapshaper.org/ to convert or simplify GeoJSON files
Make sure your file contains valid GeoJSON structure with features and geometry.
License
MIT
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-23