# Tico Maps
> Vector basemap tiles for MapLibre GL JS, served from CloudFront. No API key, no billing, no sign-up.
> Tiles only: there is no search, geocoding, routing or drive-time API at this host.
Host: https://maps.tico.dev
## Styles (use these URLs)
- Dark: https://maps.tico.dev/styles/dark.json
- Grayscale (light): https://maps.tico.dev/styles/light.json
- Both draw streets, places and landmarks only (parks, beaches, marinas, peaks, zoos, gardens, airports, ferry
terminals, stadiums, universities). No shops, restaurants or other businesses, so app pins carry the color.
- Always point a map at a style URL. Never hardcode the planet file: each style names the current
planet-YYYY-MM-DD.pmtiles and moves to the new one at each quarterly refresh. Styles are cached for 5 minutes.
- Fonts and sprites are referenced by the styles under versioned, immutable paths; don't link them directly.
## Quickstart (npm i maplibre-gl pmtiles)
```js
import * as maplibregl from "maplibre-gl";
import { Protocol } from "pmtiles";
import "maplibre-gl/dist/maplibre-gl.css";
maplibregl.addProtocol("pmtiles", new Protocol().tile);
new maplibregl.Map({ container: "map", style: "https://maps.tico.dev/styles/dark.json", center: [-117.88, 33.69], zoom: 13 });
```
- The page needs a sized container: `
`.
- maplibre-gl v6 has no default export: use `import * as maplibregl`.
- Register the pmtiles protocol once per page, before the first map.
- To switch themes, call `map.setStyle()`.
- Call `map.remove()` when a map's view goes away (one per card or route leaks WebGL contexts otherwise).
## Credit (required)
The data is OpenStreetMap (ODbL) via Protomaps. Keep the credit on the map. A compact "i" is fine; MapLibre shows the
credit open on load, and you may fold it after about 5 seconds (OSMF attribution guidelines):
```js
const map = new maplibregl.Map({ /* ... */ attributionControl: { compact: true } });
setTimeout(() => {
const el = map.getContainer().querySelector(".maplibregl-ctrl-attrib");
if (!el || el.contains(document.activeElement)) return;
el.classList.remove("maplibregl-compact-show");
el.removeAttribute("open");
}, 5000);
```
## Optional: faster tiles with one URL per byte range
The planet is read with HTTP Range requests, and browsers can hold back requests to one URL behind each other in their
HTTP cache. Giving each range its own URL (`?r=-`) lets them run in parallel. CloudFront ignores the query string, so they still hit the
cache. Measured: tiles finish about 180 ms sooner on a cold load.
```js
import * as maplibregl from "maplibre-gl";
import { PMTiles, FetchSource, Protocol } from "pmtiles";
const style = await (await fetch("https://maps.tico.dev/styles/dark.json")).json();
const planet = style.sources.protomaps.url.replace("pmtiles://", "");
const protocol = new Protocol();
protocol.add(new PMTiles({
getKey: () => planet,
getBytes: (offset, length, signal, etag) =>
new FetchSource(`${planet}?r=${offset}-${length}`).getBytes(offset, length, signal, etag),
}));
maplibregl.addProtocol("pmtiles", protocol.tile);
new maplibregl.Map({ container: "map", style });
```
## Data
- Protomaps basemap (tileset v4) built from OpenStreetMap: zoom 0-15, overzoomed beyond. Refreshed about quarterly.