Convert Figma logo to code with AI

maplibre logomartin

Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.

2,802
264
2,802
115

Top Related Projects

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

OpenMapTiles Vector Tile Schema Implementation

3,803

Mapnik is an open source toolkit for developing mapping applications

Source code of the MapServer project. Please submit pull requests to the 'main' branch.

43,292

πŸƒ JavaScript library for mobile-friendly interactive maps πŸ‡ΊπŸ‡¦

Quick Overview

Martin is a high-performance tile server for PostGIS and MBTiles, written in Rust. It provides a fast and efficient way to serve vector and raster tiles from various data sources, making it ideal for web mapping applications and geospatial data visualization.

Pros

  • High performance due to Rust implementation and efficient data handling
  • Supports multiple data sources including PostGIS, MBTiles, and PMTiles
  • Easy to configure and deploy with Docker
  • Actively maintained and regularly updated

Cons

  • Limited documentation compared to some other tile servers
  • Fewer features compared to more established tile servers like GeoServer
  • Requires some knowledge of Rust for advanced customization
  • May have a steeper learning curve for users new to tile servers

Code Examples

  1. Basic configuration for serving tiles from PostGIS:
[[datasource]]
name = "example"
type = "postgis"
host = "localhost"
port = 5432
database = "gis"
user = "postgres"
password = "password"
table = "public.mytable"
srid = 4326
geometry_column = "geom"
  1. Serving MBTiles:
[[datasource]]
name = "mbtiles_example"
type = "mbtiles"
path = "/path/to/file.mbtiles"
  1. Custom tile function:
CREATE OR REPLACE FUNCTION custom_tiles(z integer, x integer, y integer)
RETURNS bytea AS $$
    SELECT ST_AsMVT(q, 'layer', 4096, 'geom')
    FROM (
        SELECT ST_AsMVTGeom(geom, ST_TileEnvelope(z, x, y), 4096, 64, true) AS geom
        FROM mytable
        WHERE geom && ST_TileEnvelope(z, x, y)
    ) AS q;
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;

Getting Started

  1. Install Docker
  2. Create a config.toml file with your datasource configuration
  3. Run Martin with Docker:
docker run -v $(pwd)/config.toml:/config.toml -p 3000:3000 maplibre/martin
  1. Access tiles at http://localhost:3000/{datasource_name}/{z}/{x}/{y}.pbf

Competitor Comparisons

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.

Pros of tileserver-gl

  • More comprehensive documentation and examples
  • Supports multiple data formats (MBTiles, GeoJSON, KML, GPX)
  • Includes a built-in map viewer for easy visualization

Cons of tileserver-gl

  • Heavier resource usage, especially for large datasets
  • Less flexible configuration options
  • Slower tile serving performance for high-traffic scenarios

Code Comparison

tileserver-gl:

const tileserver = require('tileserver-gl');
const options = {
  paths: {
    root: __dirname,
    styles: 'styles',
    mbtiles: 'data'
  }
};
tileserver(options);

martin:

use martin::config::Config;
use martin::server::run_server;

let config = Config::from_file("config.yaml")?;
run_server(config).await?;

Key Differences

  • martin is written in Rust, offering better performance and lower resource usage
  • tileserver-gl provides a more user-friendly setup with built-in styles and viewers
  • martin offers more advanced configuration options for fine-tuning performance
  • tileserver-gl supports a wider range of input formats out-of-the-box
  • martin is more suitable for high-performance, large-scale deployments

Both projects serve vector tiles, but they cater to different use cases and skill levels. tileserver-gl is more beginner-friendly, while martin offers superior performance and flexibility for advanced users.

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

Pros of mapbox-gl-js

  • More comprehensive and feature-rich library for interactive maps
  • Extensive documentation and community support
  • Advanced styling options and customization capabilities

Cons of mapbox-gl-js

  • Requires a Mapbox access token and may incur costs for commercial use
  • Larger file size and potentially higher resource consumption
  • Less flexibility for self-hosting and customizing the core functionality

Code Comparison

mapbox-gl-js:

mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [-74.5, 40],
  zoom: 9
});

martin:

use martin::MartinServer;

let server = MartinServer::new("config.toml")?;
server.run().await?;

Key Differences

  • martin is a Rust-based vector tile server, while mapbox-gl-js is a JavaScript library for rendering interactive maps
  • martin focuses on serving vector tiles efficiently, while mapbox-gl-js provides a complete mapping solution
  • mapbox-gl-js offers more out-of-the-box features for map interaction and styling, while martin provides a lightweight backend for custom mapping applications

Use Cases

  • Choose mapbox-gl-js for rapid development of feature-rich web maps with minimal backend setup
  • Opt for martin when building custom mapping applications that require efficient vector tile serving and full control over the backend infrastructure

OpenMapTiles Vector Tile Schema Implementation

Pros of OpenMapTiles

  • Comprehensive ecosystem for creating and serving vector tiles
  • Extensive documentation and community support
  • Includes pre-defined map styles and data schemas

Cons of OpenMapTiles

  • More complex setup and configuration
  • Higher resource requirements for processing and serving tiles
  • Less flexible for custom data sources and tile formats

Code Comparison

Martin:

let config = Config::from_env()?;
let pool = db::create_pool(&config.database_url).await?;
let app = router::create_router(pool, &config).await?;

OpenMapTiles:

version: '2'
services:
  postgres:
    image: openmaptiles/postgis:2.9
    volumes:
      - ./data:/var/lib/postgresql/data
  import-osm:
    image: openmaptiles/import-osm
    depends_on:
      - postgres

Martin is a lightweight Rust-based tile server, while OpenMapTiles is a comprehensive solution for creating and serving vector tiles. Martin offers simplicity and flexibility, making it easier to integrate custom data sources and tile formats. OpenMapTiles provides a more complete ecosystem with pre-defined styles and schemas but requires more setup and resources. The code comparison shows Martin's Rust-based approach versus OpenMapTiles' Docker-based configuration, highlighting the differences in complexity and deployment strategies.

3,803

Mapnik is an open source toolkit for developing mapping applications

Pros of Mapnik

  • More mature and established project with a larger community
  • Supports a wider range of data sources and rendering options
  • Offers bindings for multiple programming languages (C++, Python, Node.js)

Cons of Mapnik

  • Steeper learning curve and more complex setup
  • Heavier resource usage, which may impact performance for some use cases
  • Less focus on modern vector tile rendering compared to Martin

Code Comparison

Mapnik (C++):

#include <mapnik/map.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/datasource_cache.hpp>

mapnik::Map m(256,256);
mapnik::layer lyr("world");
lyr.set_datasource(mapnik::datasource_cache::instance().create("shape", params));
m.add_layer(lyr);

Martin (Rust):

use martin::Map;
use martin::source::Postgis;

let mut map = Map::new();
let source = Postgis::new("dbname=gis").unwrap();
map.add_layer("world", source);

Both projects aim to provide map rendering capabilities, but Martin focuses on modern vector tiles and performance, while Mapnik offers a more comprehensive set of features for traditional map rendering. Martin's simpler API and Rust implementation may appeal to developers looking for a more streamlined solution, while Mapnik's flexibility and extensive options make it suitable for complex mapping projects.

Source code of the MapServer project. Please submit pull requests to the 'main' branch.

Pros of MapServer

  • More mature and feature-rich, with extensive documentation and a large user community
  • Supports a wider range of data formats and output types
  • Offers advanced cartographic capabilities and symbology options

Cons of MapServer

  • Steeper learning curve and more complex configuration
  • Heavier resource usage, potentially slower for simple use cases
  • Less focus on modern web technologies and real-time data handling

Code Comparison

MapServer (mapfile configuration):

MAP
  NAME "My Map"
  SIZE 600 400
  EXTENT -180 -90 180 90
  LAYER
    NAME "countries"
    TYPE POLYGON
    DATA "countries.shp"
    CLASS
      STYLE
        COLOR 200 200 200
        OUTLINECOLOR 0 0 0
      END
    END
  END
END

Martin (configuration in TOML):

[datasource]
type = "postgis"
connection_string = "postgresql://user:password@localhost/db"

[[layer]]
name = "countries"
table_name = "world_countries"
geometry_column = "geom"
srid = 4326

Both projects serve geospatial data, but Martin focuses on simplicity and performance for vector tiles, while MapServer offers a more comprehensive set of features for various mapping needs.

43,292

πŸƒ JavaScript library for mobile-friendly interactive maps πŸ‡ΊπŸ‡¦

Pros of Leaflet

  • Widely adopted and mature JavaScript library for interactive maps
  • Extensive plugin ecosystem and community support
  • Lightweight and mobile-friendly

Cons of Leaflet

  • Limited built-in support for vector tiles
  • Less suitable for complex, data-heavy visualizations
  • Requires additional libraries for advanced features

Code Comparison

Leaflet:

var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: 'Β© OpenStreetMap contributors'
}).addTo(map);

Martin:

use martin::MartinBuilder;

let martin = MartinBuilder::new()
    .with_database("postgresql://user:password@localhost/db")
    .build()?;
martin.run().await?;

Key Differences

  • Leaflet is a client-side JavaScript library for rendering maps, while Martin is a server-side Rust application for serving vector tiles
  • Leaflet focuses on map display and interaction, whereas Martin specializes in efficient tile serving from various data sources
  • Leaflet is more suitable for general-purpose web mapping, while Martin is ideal for custom tile server implementations

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Martin

Book docs.rs docs GitHub crates.io version Security audit CI build Codecov

Martin is a tile server and a set of tools able to generate vector tiles on the fly from large PostgreSQL databases, and serve tiles from PMTiles and MBTiles files. Martin optimizes for speed and heavy traffic, and is written in Rust.

Features

  • Serve vector tiles from
    • PostGIS databases, automatically discovering compatible tables and functions
    • PMTile, both local files and over HTTP
    • MBTile files
  • Combine multiple tile sources into one
  • Generate sprites and font glyphs
  • Generate tiles in bulk from any Martin-supported sources into an MBTiles file with martin-cp tool
  • Examine, copy, validate, compare, and apply diffs between MBTiles files with mbtiles tool

Documentation

Getting Involved

Join the #maplibre-martin slack channel at OSMUS -- automatic invite is at https://slack.openstreetmap.us/

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.