Delivery routes and the map

The delivery route view on POS > Fulfillments starts and ends at the shop's route start, draws the road line through the stops, and uses the shop's own map tiles: a drawn map from OpenStreetMap and an aerial photo of Bonaire. No tile request goes to a third party while the screen is open.

Where a route starts and ends

Two settings groups in Settings > POS > Delivery hold this. They live in the shop's settings document (extra_attributes), not in a table of their own.

SettingMeaning
route_start_addressThe address written next to the route start. Empty: the shop's contact address, else its legal address.
route_start_latitude, route_start_longitudeThe route start pin. Empty: shop_latitude / shop_longitude.
route_end_modereturn (default): the route comes back to the start. none: it ends at the last stop. custom: it ends at its own address.
route_end_addressThe written address for custom.
route_end_latitude, route_end_longitudeThe end pin for custom. Empty: the route start.

shop_latitude / shop_longitude keep their other job: the delivery-radius check at checkout. The route start falls back to them, so a shop that already had a shop pin keeps working without setting anything.

The point is a map pin. The address field is a label and a lookup: typing an address and choosing Find on map asks our own Photon geocoder (POST /api/v1/applications/current/route_point) and places the point. The pin can also be clicked or dragged, and the coordinates can be typed.

What the route endpoints answer

GET /api/v1/delivery/route_plans/:id/route carries the route start and end beside the line and the stops:

{
  "provider": "osrm",
  "start": {"lat": 12.167576, "lon": -68.271355},
  "end": {"lat": 12.167576, "lon": -68.271355},
  "end_mode": "return",
  "start_address": "Kaya Barakuda, Antriol, Kralendijk",
  "shop": {"lat": 12.167576, "lon": -68.271355},
  "geometry": [[12.167576, -68.271355], [12.17, -68.272]],
  "stops": [],
  "distance_m": 9120,
  "duration_s": 1200
}

shop repeats start for older screens. end is null when the route does not come back. A route with no start point at all is planned open, first stop to last.

The driving order

  • Back at the start: OSRM's trip service with roundtrip=true, source=first, destination=any.
  • End elsewhere: roundtrip=false with source=first and destination=last, the custom end being the last waypoint.
  • No return, no custom end: OSRM's trip service only accepts roundtrip=false together with source=first and destination=last, so the order is nearest neighbour from the start. The road line still comes from OSRM's route service, so the screen's "Road route" label is true for the line. The order is not the open-route optimum.
  • Without a reachable OSRM: nearest neighbour and straight lines, and the screen says so.

The tile server

commerce-tiles is a small nginx image built from tiles/ and run beside the API. It is published under /tiles/ on the admin's own host (tienda.shilohbv.com), so no new host name is needed.

PathContent
/tiles/vector.pmtilesVector tiles, OpenMapTiles schema, Bonaire + Curaçao + Aruba.
/tiles/satellite/{z}/{x}/{y}.jpgThe open aerial photo of Bonaire, Web Mercator raster tiles.
/tiles/fonts/{fontstack}/{range}.pbfMapLibre label glyphs (Noto Sans Regular and Bold, Latin ranges).
/tiles/health.jsonWhich layers the image carries; the admin reads it before creating a map.

The admin points map_tiles_base_url at this base (empty means /tiles), opens on map_default_layer (satellite by default), and shows the Map / Satellite switch when health.json says the photo is present.

Building the data

bash tiles/build.sh builds everything:

  1. Vector tiles. Planetiler (pinned version and SHA-256), OpenMapTiles schema, from the Geofabrik Central America extract, cropped to -70.3,11.9,-68.0,12.8 at maximum zoom 14, written as PMTiles.
  2. Aerial photo. tiles/fetch_satellite.py copies the Dataroom Caribisch Nederland mosaic (2025-05-27_0_rgb) at zoom 10–16 for the whole island and zoom 17 for the built-up band, converts the PNG tiles to JPEG, and skips the tiles that are plain sea. Roughly 1.2 m per pixel in the built-up band and 2.4 m elsewhere; the source does not publish its ground sample distance.
  3. Fonts. Two glyph ranges for two fonts from openmaptiles/fonts, pinned to a commit.

CI runs this only when tiles/** changes or on the quarterly refresh (the same cron as the OSRM road refresh), then builds and publishes the commerce-tiles image. Its tag is not pinned to the code commit: the image changes quarterly, not with every release.

Licences and attribution

DataLicenceAttribution shown
OpenStreetMap, through OpenMapTilesODbL 1.0; OpenMapTiles credit required© OpenMapTiles © OpenStreetMap contributors
Aerial photo of BonaireCC BY 4.0, het Waterschapshuis / Beeldmateriaal NederlandAerial photo: Het Waterschapshuis / Beeldmateriaal Nederland (CC BY 4.0)
Noto Sans glyphsSIL Open Font License 1.1(none required)

tiles/NOTICE repeats this. The imagery is copied to our own server under the CC BY 4.0 terms; the source's WMS/WMTS is not called at runtime.

When the tile server does not answer

health.json failing makes the map use the shop's map_tile_url raster fallback if one is set, and otherwise a plain background with the route line and pins on it. It does not silently switch to a public tile server: with map_tile_url empty, no third-party tile request is made.