Documentation

NextMap documentation

Getting Started

What is PMTiles?

PMTiles is a single-file archive format for map tiles. It enables efficient hosting of map tiles on static storage services like S3, without the need for a specialized tile server. This makes it ideal for web mapping applications that need to serve tiles efficiently.

How to Generate PMTiles

You can generate PMTiles files in two ways:

  1. On-Demand Generation: Generate PMTiles files immediately when needed. Go to the Create Map page to start an on-demand generation map.
  2. Scheduled Generation: Set up automatic weekly updates for PMTiles generation. Go to the Create Map page to set up generation.

Using Generated PMTiles

Once you've generated a PMTiles file, you can use it with mapping libraries like MapLibre GL JS to display interactive maps on your website or application.

API Reference

REST API

The NextMap service provides a REST API for programmatic access to the generation functionality.

Create a Generation Map
POST /api/v1/maps
Content-Type: application/json

{
  "region": "berlin",
  "style": "google-maps",
  "options": {
    "forceDownload": true,
    "generateViewer": true
  }
}
Get Map Status
GET /api/v1/maps/:mapId
Cancel a Map
DELETE /api/v1/maps/:mapId

Example Code

Using PMTiles with MapLibre GL JS

import maplibregl from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import * as pmtiles from 'pmtiles';

// Register PMTiles protocol
maplibregl.addProtocol('pmtiles', (request, callback) => {
  const p = new pmtiles.Protocol();
  return p.tile(request, callback);
});

// Create map
const map = new maplibregl.Map({
  container: 'map',
  style: {
    version: 8,
    sources: {
      'osm': {
        type: 'vector',
        url: 'pmtiles://./berlin.pmtiles'
      }
    },
    layers: [
      // Your map layers here
    ]
  },
  center: [13.4050, 52.5200], // Berlin coordinates
  zoom: 12
});