The built-in map viewer supports drag-and-drop file visualization. Drop files directly onto the map to instantly see your data as styled overlays — with client-side parsing for lightweight formats and streaming server upload for database/raster formats.
Supported Formats
tileserver-rs supports 9 geospatial file formats, split between client-side and server-side processing:
Client-Side (parsed in the browser)
| Format | Extensions | Parser | Processing |
|---|---|---|---|
| GeoJSON | .geojson, .json | destr (safe JSON parse) | Web Worker |
| CSV | .csv | papaparse (lat/lng detection) | Web Worker |
| Shapefile | .zip | shpjs (zero-copy transfer) | Web Worker |
| KML | .kml | @tmcw/togeojson | Main thread |
| GPX | .gpx | @tmcw/togeojson | Main thread |
| PMTiles | .pmtiles | pmtiles | Main thread |
Heavy file parsing (GeoJSON, CSV, Shapefile) runs in a dedicated web worker to keep the map UI responsive during large file processing.
Server-Side (uploaded and served as tile sources)
| Format | Extensions | Description |
|---|---|---|
| MBTiles | .mbtiles | SQLite-based vector tile archive |
| SQLite | .sqlite, .db | Treated as MBTiles |
| COG | .tif, .tiff | Cloud Optimized GeoTIFF |
These formats are streamed to the server via the upload API, registered as temporary tile sources, and served back as regular vector/raster tiles.
Server-side uploads require upload_dir to be configured. See Configuration for setup.
How It Works
Client-Side Flow (GeoJSON, KML, GPX, CSV, Shapefile, PMTiles)
- Drop a file onto the map viewer
- File type is detected from the extension
- File contents are read and sent to a web worker (or parsed on the main thread for KML/GPX/PMTiles)
- Parsed GeoJSON features are auto-styled with unique colors
- A new MapLibre source and layers are added to the map
- The camera auto-zooms to fit the data extent
Server-Side Flow (MBTiles, SQLite, COG)
- Drop a file onto the map viewer
- File is streamed to
POST /api/upload(chunked, no full-file buffering) - Server writes chunks to disk, validates the file, and registers it as a tile source
- Client fetches TileJSON metadata for the new source
- Vector layers are auto-styled and added to the map
Auto-Styling
Each dropped file gets a unique color from an 8-color palette. Layers are created based on geometry type:
- Polygons — fill layer + outline stroke
- LineStrings — line layer with configurable width
- Points — circle layer with radius
Overlay Management
The overlay panel (visible after dropping files) lets you:
- Toggle visibility — show/hide individual overlays with the eye icon
- Remove overlays — delete overlays with the trash button (also cleans up server uploads)
- See metadata — file name, format badge, and feature count per overlay
Configuration
Enable Server-Side Uploads
Add the following to your config.toml:
[server]
upload_dir = "/data/uploads"
upload_max_size_mb = 500
| Option | Description | Default |
|---|---|---|
upload_dir | Directory for uploaded files | - |
upload_max_size_mb | Maximum upload file size in MB | 500 |
Uploaded sources are session-only — they persist until deleted or the server restarts. They are not saved to the config file.
Client-Side Formats (No Config Needed)
GeoJSON, KML, GPX, CSV, Shapefile, and PMTiles files are processed entirely in the browser. No server configuration is required for these formats.
Upload API
The file drop feature uses three REST endpoints under the hood:
| Endpoint | Method | Description |
|---|---|---|
/api/upload | POST | Upload a file (streaming multipart) |
/api/upload | GET | List all uploaded sources |
/api/upload/{id} | DELETE | Remove an upload and delete the file |
See the API reference for full details.
Tips
- Large GeoJSON files are parsed in a web worker, so the map stays interactive even during multi-MB file processing
- Shapefile uploads must be
.ziparchives containing.shp,.dbf, and.shxfiles — standalone.shpfiles are rejected with a helpful error message - CSV files need columns containing latitude and longitude values — the parser auto-detects common column names (
lat,latitude,lng,longitude,lon, etc.) - PMTiles files are loaded directly via an object URL — no server upload needed
Next Steps
- API Endpoints — Upload API reference
- Configuration — Enable upload directory
- Docker Deployment — Volume mounts for upload persistence