### Setup Martin Environment on Linux Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-linux.md Create a directory, download sample data, and check for sqlite installation. ```bash mkdir martin cd martin # Download some sample data curl -L -O https://github.com/maplibre/martin/raw/main/tests/fixtures/mbtiles/world_cities.sql # Check if sqlite is installed sqlite3 --version ``` ```bash sqlite3 world_cities.mbtiles < world_cities.sql ``` -------------------------------- ### Start Development Services Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Starts the test database and the Martin server for development. Use 'just test' to verify the setup. ```bash just start # test database just run # Martin server just test # verify setup ``` -------------------------------- ### Install Just and Validate Tools Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Install the Just build tool and verify your development environment setup. ```bash cargo install just --locked just validate-tools ``` ```bash just validate-tools ``` -------------------------------- ### Run Development Setup Commands Source: https://github.com/maplibre/martin/blob/main/docs/content/getting-involved.md Execute these commands to validate your tools and start the development environment, including the test database. ```bash # Validate all required tools are installed just validate-tools # Start the development environment just start # starts test database just help # shows common commands ``` -------------------------------- ### Install and Validate Development Tools Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Installs the 'just' tool and validates the development setup. Ensure 'just' is installed before proceeding with other commands. ```bash cargo install just --locked just validate-tools ``` -------------------------------- ### Start Martin with Docker Compose Source: https://github.com/maplibre/martin/blob/main/demo/README.md Run this command to start the Martin tile server using the provided Docker Compose setup. Access the service at https://localhost. ```shell just demo::up ``` -------------------------------- ### Install Martin with Docker Source: https://context7.com/maplibre/martin/llms.txt Recommended method for a quick start. Sets up environment variables and runs the Martin container, mapping port 3000. ```bash # Docker (recommended for quick start) export PGPASSWORD=postgres docker run -p 3000:3000 \ -e PGPASSWORD \ -e DATABASE_URL=postgres://user@host:5432/db \ ghcr.io/maplibre/martin:1.9.1 ``` -------------------------------- ### Run Martin UI Locally Source: https://github.com/maplibre/martin/blob/main/martin/martin-ui/README.md Install dependencies and start the development server for the Martin UI. Ensure VITE_MARTIN_BASE is configured if the UI is not on the same origin as the Martin instance. ```bash npm i npm run dev ``` -------------------------------- ### Build and Serve Documentation Source: https://github.com/maplibre/martin/blob/main/docs/README.md Run this command from the project root to install zensical as a Docker container, then build and serve the documentation locally. Docker must be installed on your system. ```bash just docs ``` -------------------------------- ### Start Martin with a Configuration File Source: https://github.com/maplibre/martin/blob/main/docs/content/config-file/index.md Pass the path to your configuration file using the `--config` argument to start Martin. ```bash martin --config config.yaml ``` -------------------------------- ### Initial Git Repository Setup Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Clone the primary repository as 'upstream' and add your personal fork as 'origin'. This setup is recommended for all contributors. ```bash # clone the primary fork to your local machine, naming the remote "upstream" # make sure to replace the URL with the correct one git clone -o upstream https://github.com/maplibre/martin.git cd martin # add your own fork as a remote, naming it "origin" git remote add origin https://github.com/nyurik/martin.git ``` -------------------------------- ### Serve MBTiles and PostGIS Data with Martin Source: https://github.com/maplibre/martin/blob/main/docs/content/recipe-basemap-postgis.md Starts the Martin server to serve tiles from a local MBTiles file and a PostGIS database. Ensure Martin binary is installed and accessible. ```bash martin data/monaco.mbtiles postgres://postgres:mypass@localhost:5432/postgres ``` -------------------------------- ### Start Docker Compose Source: https://github.com/maplibre/martin/blob/main/docs/content/pg-ssl-certificates.md Command to build and start the services defined in your docker-compose.yml file. ```bash docker compose up ``` -------------------------------- ### Run PostGIS Docker Container Source: https://github.com/maplibre/martin/blob/main/docs/content/recipe-basemap-postgis.md Starts a PostGIS Docker container named 'some-postgis' and publishes its port. Requires Docker to be installed. ```bash docker run \ --name some-postgis \ --env POSTGRES_PASSWORD=mypass \ --publish 5432:5432 \ --detach \ postgis/postgis ``` -------------------------------- ### Configuration and Initialization Flow Diagram Source: https://github.com/maplibre/martin/blob/main/docs/content/architecture.md Details the process of configuration parsing, source discovery, and server setup during Martin's initialization. ```mermaid sequenceDiagram participant CLI participant Config as Config Parser participant Discovery as Source Discovery participant Sources as Tile Sources participant Server as HTTP Server CLI->>Config: Parse args & config file Config->>Discovery: Initialize sources alt PostgreSQL Source Discovery->>Discovery: Connect to database Discovery->>Discovery: Query tables & functions Discovery->>Sources: Register table sources Discovery->>Sources: Register function sources end alt File Sources Discovery->>Discovery: Scan MBTiles files Discovery->>Discovery: Scan PMTiles files Discovery->>Sources: Register file sources end Sources-->>Server: Source catalog Server->>Server: Setup routes Server->>Server: Start HTTP listener ``` -------------------------------- ### Build Martin from Source Source: https://context7.com/maplibre/martin/llms.txt Compiles and installs Martin from source using Cargo. Includes a command to display help. ```bash # Build from source cargo install martin --locked martin --help ``` -------------------------------- ### Install Martin with cargo-binstall Source: https://github.com/maplibre/martin/blob/main/docs/content/installation.md Install Martin using cargo-binstall for Rust users. This method requires Rust and cargo to be installed. ```bash cargo install cargo-binstall cargo binstall martin MARTIN --help ``` -------------------------------- ### Install Martin with Homebrew Source: https://github.com/maplibre/martin/blob/main/docs/content/installation.md Install Martin on macOS using Homebrew. This command taps the repository and installs the package. ```bash brew tap maplibre/martin brew install martin MARTIN --help ``` -------------------------------- ### Start the PostgreSQL Database Service Source: https://github.com/maplibre/martin/blob/main/docs/content/run-with-docker-compose.md Use this command to start the `db` service in detached mode. Ensure the database is running before starting the Martin service. ```bash docker compose up -d db ``` -------------------------------- ### Install and Use mbtiles CLI Tool Source: https://context7.com/maplibre/martin/llms.txt Install the `mbtiles` CLI tool using Cargo. Use it to summarize MBTiles archives, manage metadata, copy archives with filters, validate integrity, and diff/patch archives. ```bash cargo install mbtiles --locked ``` ```bash mbtiles summary world_cities.mbtiles ``` ```bash # MBTiles file summary for world_cities.mbtiles # Schema: flat | File size: 48.00kB # Zoom | Count | Smallest | Largest | Average | Bounding Box # 0 | 1 | 1.0kB | 1.0kB | 1.0kB | -180,-85,180,85 # ... ``` ```bash mbtiles meta-all my.mbtiles ``` ```bash mbtiles meta-get my.mbtiles description ``` ```bash mbtiles meta-set my.mbtiles description "Updated world cities dataset" ``` ```bash mbtiles copy src.mbtiles dst.mbtiles --min-zoom 0 --max-zoom 10 ``` ```bash mbtiles copy normalized.mbtiles flat.mbtiles --dst-type flat-with-hash ``` ```bash mbtiles validate my.mbtiles ``` ```bash # [INFO] The agg_tiles_hashes=E95C1081447FB25674DCC1EB97F60C26 has been verified. ``` ```bash mbtiles diff v1.mbtiles v2.mbtiles delta.mbtiles ``` ```bash mbtiles apply-patch v1.mbtiles delta.mbtiles v2_restored.mbtiles ``` ```bash mbtiles diff original.mbtiles updated.mbtiles diff.mbtiles --patch-type bin-diff-raw ``` ```bash mbtiles copy diff.mbtiles original.mbtiles target.mbtiles --apply-patch ``` ```bash mbtiles copy src.mbtiles dst.mbtiles --apply-patch delta.mbtiles ``` -------------------------------- ### Start Martin with PostgreSQL Table Source Source: https://context7.com/maplibre/martin/llms.txt Launch Martin and configure it to serve tiles from a PostgreSQL database. Martin automatically discovers tables with geometry columns. ```bash # Martin auto-discovers the table; no config change needed martin postgres://postgres@localhost/db ``` -------------------------------- ### Load Martin Configuration from File Source: https://context7.com/maplibre/martin/llms.txt Starts Martin using a specified YAML configuration file, disabling other tile-source CLI flags. ```bash # Load config file (disables all other tile-source CLI flags) martin --config /etc/martin/config.yaml ``` -------------------------------- ### Start the Martin Service Source: https://github.com/maplibre/martin/blob/main/docs/content/run-with-docker-compose.md After the database service is ready, use this command to start the `martin` service in detached mode. Martin will then be accessible at the configured port. ```bash docker compose up -d martin ``` -------------------------------- ### Configure Tile Sources via YAML Source: https://context7.com/maplibre/martin/llms.txt Configuration file example for Martin, specifying paths for MBTiles and PMTiles sources, with options for conversion and remote URLs. ```yaml mbtiles: paths: - /data/mbtiles # auto-discover + hot-reload sources: world: /data/world.mbtiles pmtiles: sources: planet: path: s3://my-bucket/planet-latest.pmtiles convert_to_mlt: auto # serve as MLT when client requests it labels: path: https://cdn.example.com/labels.pmtiles legacy_raster: path: /data/imagery.mbtiles convert_to_mlt: disabled convert_to_mvt: disabled ``` -------------------------------- ### Initialize Database and Run Martin Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-macos.md Commands to initialize a SQLite database with demo data and start the Martin server. Ensure you are in the directory containing the Martin executable and the SQL file. ```bash sqlite3 world_cities.mbtiles < world_cities.sql ``` ```bash ./martin --help ``` ```bash ./martin world_cities.mbtiles ``` -------------------------------- ### Check SQLite Installation Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-windows.md Verify if SQLite is installed on your system. This is a prerequisite for initializing the MBTiles database. ```bash # Check if sqlite is installed sqlite3 --version ``` -------------------------------- ### Martin Configuration File Example Source: https://context7.com/maplibre/martin/llms.txt A comprehensive YAML configuration file for Martin, demonstrating settings for listening addresses, caching, PostgreSQL, MBTiles, PMTiles, sprites, fonts, styles, and CORS. ```yaml # yaml-language-server: $schema=https://raw.githubusercontent.com/maplibre/martin/main/schemas/config.json listen_addresses: 0.0.0.0:3000 worker_processes: 8 keep_alive: 75 preferred_encoding: gzip # or brotli base_path: /tiles # prefix injected into TileJSON URLs # In-memory cache (512 MB total by default) cache: size_mb: 512 tile_size_mb: 256 expiry: "1h" # evict after 1 hour regardless of access idle_timeout: "10m" # evict if not accessed for 10 minutes maxzoom: 14 # don't cache tiles beyond zoom 14 # PostgreSQL sources postgres: connection_string: ${DATABASE_URL:-postgres://postgres@localhost/db} pool_size: 20 default_srid: 4326 auto_bounds: quick # quick | calc | skip auto_publish: tables: buffer: 64 extent: 4096 id_columns: [gid] tables: custom_table: schema: public table: my_layer geometry_column: geom srid: 4326 geometry_type: POINT properties: name: text population: int4 # MBTiles sources mbtiles: paths: - /data/mbtiles # auto-discover *.mbtiles; hot-reload on changes sources: basemap: /data/world.mbtiles # PMTiles sources (local, HTTP, S3, GCS, Azure) pmtiles: sources: planet: s3://my-bucket/planet.pmtiles local: /data/overlay.pmtiles directory_cache: size_mb: 128 # Sprite sources sprites: paths: - /data/sprites/icons # all SVGs → sprite_id "icons" sources: transport: /data/sprites/transport # Font sources fonts: - /data/fonts # Style sources styles: paths: - /data/styles sources: demo: /data/styles/demo.json # CORS cors: origin: - https://myapp.example.com max_age: 3600 ``` -------------------------------- ### Install Martin with Debian Package Source: https://context7.com/maplibre/martin/llms.txt Installs Martin on Debian/Ubuntu systems using a downloaded .deb package. ```bash # Debian/Ubuntu x86_64 curl -O https://github.com/maplibre/martin/releases/latest/download/debian-x86_64.deb sudo dpkg -i ./debian-x86_64.deb ``` -------------------------------- ### Install Martin with Homebrew Source: https://context7.com/maplibre/martin/llms.txt Installs Martin on macOS using the Homebrew package manager. ```bash # Homebrew (macOS) brew tap maplibre/martin brew install martin ``` -------------------------------- ### Run Martin with Demo Data Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-windows.md Start the Martin tile server using the prepared MBTiles file as the sole data source. This command makes the demo map accessible. ```bash # Run Martin with the sample data as the only tile source martin world_cities.mbtiles ``` -------------------------------- ### Serve Local MBTiles and PMTiles Source: https://context7.com/maplibre/martin/llms.txt Starts Martin to serve local MBTiles files and remote or local PMTiles archives. ```bash # Serve local MBTiles / PMTiles files martin /path/to/tiles.mbtiles /path/to/directory https://example.org/remote.pmtiles ``` -------------------------------- ### Copy .env to .env.local Source: https://github.com/maplibre/martin/blob/main/martin/martin-ui/README.md Copy the default environment variables file to a local file to customize your setup. ```bash cp .env .env.local ``` -------------------------------- ### Update Existing Git Repository Setup Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Update an existing local clone to follow the recommended Git remote setup ('upstream' for the primary repo, 'origin' for your fork). ```bash # Getting a quick glance about your remotes: git remote -v git remote -v # Rename the existing remote to "upstream". Your "main" branch will now track "upstream/main" git remote rename origin upstream # Add your own fork as a remote, naming it "origin" (adjust the URL) git remote add origin https://github.com/nyurik/martin.git ``` -------------------------------- ### Mix Sources and Configure Martin Source: https://context7.com/maplibre/martin/llms.txt Starts Martin with mixed data sources, custom listen addresses, limited PostgreSQL pool size, and saves the configuration to a file. ```bash # Mix sources, set listen address, limit PG pool, save auto-generated config martin postgres://postgres@localhost/db \ /data/overlay.pmtiles \ --listen-addresses 0.0.0.0:8080 \ --pool-size 10 \ --save-config /etc/martin/config.yaml ``` -------------------------------- ### Run Maputnik Locally Source: https://github.com/maplibre/martin/blob/main/docs/content/recipe-basemap-postgis.md Use this Docker command to start a local instance of Maputnik for map styling. ```bash docker run -it --rm -p 8888:80 ghcr.io/maplibre/maputnik:main ``` -------------------------------- ### Run Martin with PostgreSQL Connection String Source: https://github.com/maplibre/martin/blob/main/docs/content/run/index.md Provide a PostgreSQL connection string as a command-line argument to start Martin. Alternatively, the connection string can be set via the DATABASE_URL environment variable. ```bash martin postgres://postgres@localhost/db ``` -------------------------------- ### Build Martin from Source with Cargo Source: https://github.com/maplibre/martin/blob/main/docs/content/installation.md Build Martin from source using Cargo. This method requires Rust to be installed. ```bash cargo install martin --locked MARTIN --help ``` -------------------------------- ### Fetch TileJSON for Composite Sources Source: https://context7.com/maplibre/martin/llms.txt Example using curl and jq to retrieve the TileJSON for a composite source made up of multiple individual sources. ```bash curl http://localhost:3000/roads,buildings,pois | jq ``` -------------------------------- ### Run Martin with Sample Data on Linux Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-linux.md Display the help screen and run Martin with the downloaded sample data. ```bash ./martin --help ``` ```bash ./martin world_cities.mbtiles ``` -------------------------------- ### Configure Martin with Environment Variables Source: https://github.com/maplibre/martin/blob/main/docs/content/pg-ssl-certificates.md Set environment variables for Martin to connect to a PostgreSQL database using SSL. This method is suitable for quick setups or containerized environments. ```bash export PGSSLROOTCERT=./ca-cert.pem export DATABASE_URL="postgres://postgres:password@localhost:5432/postgres?sslmode=verify-full" martin ``` -------------------------------- ### Custom Debug Launch Configuration Source: https://github.com/maplibre/martin/blob/main/docs/content/getting-involved.md Modify this configuration to include specific command-line arguments and environment variables for debugging Martin. The example shows how to pass a database connection string and set a default SRID. ```javascript { "type": "lldb", "request": "launch", "name": "my first debug", // name it any as you like "cargo": { "args": [ "build", "--bin=martin", "--package=martin" ], "filter": { "name": "martin", "kind": "bin" } }, "args": ["postgres://postgres:postgres@localhost:5411/db"], // add your arguments here "env": { "DEFAULT_SRID": 4490, // add your env here }, "cwd": "${workspaceFolder}" } ``` -------------------------------- ### Create a binary diff file Source: https://github.com/maplibre/martin/blob/main/docs/content/mbtiles-diff.md Generate a diff file using binary patching to significantly reduce the size of the difference file. This example uses Brotli-compressed binary diffs with uncompressed input tiles. ```bash mbtiles diff original.mbtiles updated.mbtiles diff.mbtiles --patch-type bin-diff-raw ``` -------------------------------- ### Install Martin with unstable COG feature Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-cog-files.md Install Martin with the unstable COG feature enabled. This requires Rust to be installed. ```bash cargo install martin --features=unstable-cog ``` -------------------------------- ### Install Debian Package Manually Source: https://github.com/maplibre/martin/blob/main/docs/content/installation.md Manually install the Martin Debian package (.deb) on x86_64 systems. This involves downloading the package, installing it with dpkg, and cleaning up. ```bash curl -O https://github.com/maplibre/martin/releases/latest/download/debian-x86_64.deb sudo dpkg -i ./debian-x86_64.deb MARTIN --help rm ./debian-x86_64.deb ``` -------------------------------- ### Serve Tiles from Local and Remote Sources via CLI Source: https://context7.com/maplibre/martin/llms.txt Demonstrates how to use the Martin CLI to serve tiles from a mix of local MBTiles/PMTiles files and remote PMTiles URLs. ```bash martin \ /data/world-base.mbtiles \ /data/overlay.pmtiles \ https://example.com/cdn/labels.pmtiles \ s3://my-bucket/planet-latest.pmtiles ``` -------------------------------- ### List Available 'just' Recipes Source: https://github.com/maplibre/martin/blob/main/martin/martin-ui/README.md View all available development tasks defined in the 'just' configuration file. ```bash just ``` -------------------------------- ### Download and Prepare Martin Binary on Linux Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-linux.md Download the latest Martin binary, extract it, and make it executable. ```bash curl -L -O https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz tar -xzf martin-x86_64-unknown-linux-gnu.tar.gz chmod +x ./martin ``` -------------------------------- ### Example Catalog Response Source: https://github.com/maplibre/martin/blob/main/docs/content/using.md An example of the JSON response structure from the `/catalog` endpoint, detailing available tiles, sprites, fonts, and styles. ```json { "tiles" { "function_zxy_query": { "name": "public.function_zxy_query", "content_type": "application/x-protobuf" }, "points1": { "name": "public.points1.geom", "content_type": "image/webp" }, ... }, "sprites": { "cool_icons": { "images": [ "bicycle", "bear", ] }, ... }, "fonts": { "Noto Mono Regular": { "family": "Noto Mono", "style": "Regular", "glyphs": 875, "start": 0, "end": 65533 }, ... }, "styles": { "maplibre_demo": { "path": "path/to/maplibre_demo.json", }, }, } ``` -------------------------------- ### Initialize MBTiles Database Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-windows.md Create an MBTiles database file from a SQL dump. This command imports the demo tile data into a local file. ```bash # Initialize a database sqlite3 world_cities.mbtiles < world_cities.sql ``` -------------------------------- ### martin-cp Help Output Source: https://github.com/maplibre/martin/blob/main/docs/content/martin-cp.md View available options for the martin-cp tool by running the --help command. This provides a comprehensive list of arguments for tile generation and configuration. ```text --8<-- "help/martin-cp.txt" ``` -------------------------------- ### Get Style JSON Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-styles.md Retrieves the JSON content for a specific style ID. ```APIDOC ## GET /style/ ### Description Retrieves the JSON content for a specific style ID. ### Endpoint /style/ ### Parameters #### Path Parameters - **style_id** (string) - Required - The ID of the style to retrieve. ``` -------------------------------- ### Get Style Catalog Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-styles.md Retrieves a list of all available style IDs from the server. ```APIDOC ## GET /catalog ### Description Retrieves a list of all available style IDs. ### Endpoint /catalog ``` -------------------------------- ### Serve PostGIS Data Source: https://context7.com/maplibre/martin/llms.txt Starts Martin to serve all tables and functions from a specified PostgreSQL database. ```bash # Serve all PostGIS tables and functions martin postgres://postgres:password@localhost/mydb ``` -------------------------------- ### Create PostgreSQL Function for Raster Tiles Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-pg-functions.md This example demonstrates how to create a PostgreSQL function that returns raster tiles and how to set the `content_type` in the SQL comment for Martin to recognize it as a raster tile source. Ensure the `content_type` matches the actual tile format returned by your function. ```sql CREATE OR REPLACE FUNCTION public.my_raster_tiles( z integer, x integer, y integer ) RETURNS bytea AS $$ -- Replace with your actual raster tile generation logic SELECT get_raster_tile(z, x, y); $$ LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE; DO $do$ BEGIN EXECUTE 'COMMENT ON FUNCTION public.my_raster_tiles IS $tj$' || $$ { "description": "My raster tile layer", "content_type": "image/png" } $$::json || '$tj$'; END $do$; ``` -------------------------------- ### Serve PMTiles from Google Cloud Storage (CLI) Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-files.md Serve PMTiles from a Google Cloud Storage bucket. Specify the bucket name and the object path. ```bash martin gs://my-bucket/tiles.pmtiles ``` -------------------------------- ### Display Martin Help Screen Source: https://github.com/maplibre/martin/blob/main/docs/content/quick-start-windows.md Show the available command-line options and usage instructions for Martin. Useful for understanding configuration and features. ```bash # Show Martin help screen martin --help ``` -------------------------------- ### Retrieve Style JSON Source: https://context7.com/maplibre/martin/llms.txt Example using curl to fetch a MapLibre Style JSON file served by Martin. ```bash # Retrieve a style JSON curl http://localhost:3000/style/basemap | jq ``` -------------------------------- ### List Available Just Commands Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Displays help for common commands or lists all available commands in the 'justfile'. ```bash just help # common commands just --list # all commands just validate-tools # check setup ``` -------------------------------- ### Initialize Map with PMTiles Source Source: https://github.com/maplibre/martin/blob/main/martin-core/examples/pmtiles-tileserver.html Sets up a map instance using maplibre-gl-js, pointing to a local PMTiles tile server. Includes basic map controls. ```javascript const map = new maplibregl.Map({ container: 'map', style: 'http://localhost:3000/style.json', center: [0, 20], zoom: 2 }); map.addControl(new maplibregl.NavigationControl()); ``` -------------------------------- ### Get Rendered Tile Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-styles.md Generates and retrieves a rasterized image (PNG or JPEG) for a specific XYZ tile of a given style. ```APIDOC ## GET /style//{z}/{x}/{y}.{filetype} ### Description Generates and retrieves a rasterized image (PNG or JPEG) for a specific XYZ tile of a given style. Requires `styles.rendering: true` in the configuration. ### Endpoint /style//{z}/{x}/{y}.{filetype} ### Parameters #### Path Parameters - **style_id** (string) - Required - The ID of the style to render. - **z** (integer) - Required - The zoom level. - **x** (integer) - Required - The X coordinate of the tile. - **y** (integer) - Required - The Y coordinate of the tile. - **filetype** (string) - Required - The image format (e.g., png, jpeg). ``` -------------------------------- ### Serve PMTiles from Amazon S3 (CLI) Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-files.md Serve PMTiles from an Amazon S3 bucket. Provide the bucket name and the object key prefix. ```bash martin s3://my-bucket/tiles.pmtiles ``` -------------------------------- ### Serve MBTiles and PMTiles Files from CLI Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-files.md Serve tile files by providing their paths or URLs directly on the command line. Supports both MBTiles and PMTiles formats. ```bash martin /path/to/mbtiles/file.mbtiles /path/to/directory https://example.org/path/tiles.pmtiles ``` -------------------------------- ### List MBTiles commands Source: https://github.com/maplibre/martin/blob/main/docs/content/mbtiles/index.md Use `mbtiles --help` to display a list of all available commands for the MBTiles utility. ```text --8<-- "help/mbtiles.txt" ``` -------------------------------- ### Default TileJSON Manifest Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-pg-tables.md An example of a TileJSON manifest automatically generated by Martin for a PostgreSQL table source. The 'bounds' are queried from the database by default. ```json { "tilejson": "3.0.0", "tiles": [ "http://localhost:3000/table_source/{z}/{x}/{y}" ], "vector_layers": [ { "id": "table_source", "fields": { "gid": "int4" } } ], "bounds": [ -2.0, -1.0, 142.84131509869133, 45.0 ], "description": "public.table_source.geom", "name": "table_source" } ``` -------------------------------- ### Create Martin Lambda Layer Binary Source: https://github.com/maplibre/martin/blob/main/docs/content/run-with-lambda.md Download the Martin binary for ARM64 and extract it into the staging directory for creating a Lambda layer. This prepares the binary to be included in the layer's PATH. ```bash mkdir -p martin_layer/src/bin/ cd martin_layer curl -OL https://github.com/maplibre/martin/releases/latest/download/martin-aarch64-unknown-linux-musl.tar.gz tar -C src/bin/ -xzf martin-aarch64-unknown-linux-musl.tar.gz martin ``` -------------------------------- ### Get Font Glyph Range Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-fonts.md Request a specific range of glyphs from a single font. Ensure font names are URL-escaped if they contain spaces. ```bash curl http://127.0.0.1:3000/font/Overpass%20Mono%20Bold/0-255 ``` -------------------------------- ### Run Frontend Tests with 'just' Source: https://github.com/maplibre/martin/blob/main/martin/martin-ui/README.md Execute the frontend test suite using the 'just' task runner. ```bash just test ``` -------------------------------- ### Core Development Workflow Commands Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Common commands for the development workflow, including starting services, running tests, formatting, linting, and managing documentation. ```bash just start # start test database just run # start Martin server just test # run all tests just fmt # format code just clippy # lint code just docs # serve documentation preview just stop # stop test database ``` -------------------------------- ### Fetch Composite Vector Tile Source: https://context7.com/maplibre/martin/llms.txt Example using curl to fetch a composite vector tile (MVT) from Martin, combining data from multiple sources. ```bash curl http://localhost:3000/roads,buildings,pois/14/8192/5461 --output composite.mvt ``` -------------------------------- ### Fetch Raster Tile from PostgreSQL Function Source: https://context7.com/maplibre/martin/llms.txt Example using curl to fetch a PNG raster tile generated by a PostgreSQL function served by Martin. ```bash curl http://localhost:3000/heatmap_png/8/128/86 --output heatmap.png ``` -------------------------------- ### Configure Martin with Command Line Source: https://github.com/maplibre/martin/blob/main/docs/content/pg-ssl-certificates.md Specify PostgreSQL SSL connection details directly via Martin's command-line arguments. Ideal for ad-hoc connections or scripting. ```bash martin --ca-root-file ./ca-cert.pem \ "postgres://postgres:password@localhost:5432/postgres?sslmode=verify-full" ``` -------------------------------- ### Sprite Index JSON Example Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-sprites.md This JSON describes the position and size of each image within a sprite sheet. It is available for both standard and high DPI versions. ```json { "bicycle": { "height": 15, "pixelRatio": 1, "width": 15, "x": 20, "y": 16 }, ... } ``` -------------------------------- ### Get Composite TileJSON Source: https://context7.com/maplibre/martin/llms.txt Retrieve TileJSON for a composite source, merging multiple sources like 'points' and 'lines'. Use 'jq' for formatted output. ```bash curl http://localhost:3000/points,lines | jq ``` -------------------------------- ### Serve PMTiles from Local File System (CLI) Source: https://github.com/maplibre/martin/blob/main/docs/content/sources-files.md Use this command to serve PMTiles directly from a local file path or URL. Supports relative paths and file URIs. ```bash martin path/to/tiles.pmtiles ``` -------------------------------- ### Generate MBTiles Basemap with Planetiler Source: https://github.com/maplibre/martin/blob/main/docs/content/recipe-basemap-postgis.md Downloads and generates an MBTiles archive for a specified area using Planetiler. Ensure Docker is installed and the data directory exists. ```bash mkdir --parents data docker run \ --user=$UID \ -e JAVA_TOOL_OPTIONS="-Xmx1g" \ -v "$(pwd)/data":/data \ --rm \ ghcr.io/onthegomap/planetiler:latest \ --download \ --minzoom=0 \ --maxzoom=14 \ --tile_compression=none \ --area=monaco \ --output /data/monaco.mbtiles ``` -------------------------------- ### Run Sub-project Commands Source: https://github.com/maplibre/martin/blob/main/docs/content/development/index.md Execute commands for sub-projects like the web UI or demo. Commands are namespaced using '::'. ```bash # Web UI (martin/martin-ui/) just ui::test # run frontend tests just ui::biome # run BiomeJS formatter and linter just ui::type-check # TypeScript type checking # Demo (demo/) just demo::up # start the demo with Docker Compose just demo::build # build demo Docker images ``` -------------------------------- ### Serve Styles via CLI Source: https://context7.com/maplibre/martin/llms.txt Command-line interface command to serve MapLibre Style JSON files from a specified directory. ```bash martin --style /data/styles/ ```