Skip to content

flowaxy/geomap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoMapSvgGenerator

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): Latitude
  • lng (float): Longitude
  • type (string): Marker type (used as CSS class)
  • icon (string): Emoji or symbol instead of circle
  • count (int): Number shown below
  • label (string): Text label
  • name (string): Tooltip text

Getting GeoJSON files

You can download GeoJSON files for countries, regions, or the entire world from:

For Ukraine specifically, you can try:

Make sure your file contains valid GeoJSON structure with features and geometry.

License

MIT

About

An SVG map generator from GeoJSON for Flowaxy projects.

Topics

Resources

License

Stars

Watchers

Forks

Languages