Back to Documentation

Routing & Directions

Build layer routes, optimize stop order, and open stops in Google Maps

Last updated: April 18, 2026

Routing & Directions

Mapiry supports three routing experiences:

  • Get Directions for a single location
  • Layer routes for an ordered set of locations inside one layer
  • Route optimization to reorder layer pins for the shortest time or distance

This page covers what is currently available in the product.

Single-Location Directions

Any viewer can open directions for a single pin.

Where it appears:

  • Public map pages
  • Embedded maps

How it works:

  1. Open a location popup
  2. Click Get Directions
  3. Mapiry opens Google Maps with that location as the destination

This is a handoff to Google Maps, not turn-by-turn navigation inside Mapiry.

Layer Routes

Layer routes let you draw one route through all pins in a layer.

Mapiry uses the current pin order in that layer:

  • First pin = first stop
  • Second pin = second stop
  • And so on

This is useful for:

  • Day-by-day itineraries
  • Food crawls
  • Event schedules
  • Delivery or field visit sequences

Turn On a Layer Route

Layer routes are configured per layer.

  1. Open your map in the editor
  2. Open the layer manager
  3. Create a new layer or edit an existing one
  4. Enable Layer route
  5. Save

The editor label is:

  • Layer route: Draw route through this layer using pin order.

Show Route by Default

There is also an optional setting:

  • Show route by default

What it does:

  • Automatically shows the route when visitors open that layer
  • Uses the cached route that was previously generated

Important:

  • This setting is Pro-gated in the editor
  • Owners need to generate the route at least once before visitors can see it by default
  • If no cached route exists yet, Mapiry will not auto-build one for visitors

Generate and View a Layer Route

On a map with an active layer route:

  1. Switch to a layer that has routing enabled
  2. Use Show route
  3. Mapiry draws the route on the map
  4. The sidebar shows:
    • stop count
    • total distance
    • total duration
    • per-leg breakdown between stops

If available, the panel also shows a Google Maps button to open that route externally.

Important:

  • Owners can generate uncached layer routes
  • Viewers and logged-out visitors can only see a layer route if the owner already generated and cached it
  • Public visitors cannot spend the map owner's credits by clicking Show route

Optimize a Layer Route

Route optimization is available to the map owner for route-enabled layers.

What it does:

  • Reorders the pins inside one layer
  • Keeps the selected first stop fixed
  • Optionally keeps a selected final stop fixed
  • Draws the resulting route after optimization
  • Stores the optimized order on that layer

Available optimization modes:

  • Shortest time — minimizes travel time
  • Shortest distance — minimizes travel distance

How it works:

  1. Open a route-enabled layer in the editor or owner view
  2. Click Optimize route
  3. Choose an optimization mode
  4. Choose a required First stop
  5. Optionally choose a Final stop
  6. Review the credit quote
  7. Run the optimization

If you leave Final stop empty, Mapiry chooses the best final stop automatically.

After optimization:

  • the layer shows that it is optimized
  • the route summary reflects the optimized order
  • manual reordering, adding pins, removing pins, or other route-affecting changes clear the optimized status

Credits

Routing uses credits.

Current credit behavior:

  • Point-to-point directions request: about 2 credits
  • Layer route generation request: about 2 credits
  • Route optimization cost depends on layer size because Mapiry uses:
    • one Mapbox Matrix request for all pins in the layer
    • one Directions request for the final route geometry
  • The exact optimization quote is shown before the owner confirms the run

Cached layer routes help avoid repeated re-generation when the stop list has not changed.

Cached optimization reruns cost 0 credits only when Mapiry can reuse the existing result without making any external API calls.

Limits and Rules

  • A layer route needs at least 2 pins
  • Layer routes support up to 25 stops
  • Route optimization currently supports up to 10 pins
  • Standard routes follow pin order unless the owner runs route optimization
  • Routes are currently built with Mapbox driving directions
  • Route optimization uses Mapbox Matrix data plus an in-app solver
  • If pins change order, coordinates, or layer membership, the route may need to be regenerated and optimized again

Embedded Maps

Embedded maps support single-location Get Directions links in popups.

Embeds do not currently provide the full layer-route planning or optimization UI that the main map experience has.

Troubleshooting

I don't see "Show route"

Check:

  • the current layer has Layer route enabled
  • the layer has at least 2 pins
  • if you are not the owner, the route may also need to be generated and cached first

The route is wrong

Layer routes follow the order of pins in the layer. Reorder the locations if the stop sequence should change.

If the layer was optimized earlier, route-affecting edits can clear that optimization and return the layer to its manual order.

I don't see "Optimize route"

Check:

  • you are the map owner
  • the current layer has Layer route enabled
  • the layer has at least 2 pins
  • the layer is not already in a valid optimized state

Why is optimization unavailable for this layer?

Common reasons:

  • the layer has more than 10 pins
  • the selected first stop and final stop are the same
  • the owner does not have enough credits for the quoted run
  • some pins cannot be routed together

Visitors don't see the route by default

Check:

  • Show route by default is enabled
  • the owner generated the route at least once
  • the map owner has access to that Pro-gated default behavior

Google Maps button is missing

The Google Maps handoff appears when there is an available route summary for the active layer route.

Related Articles