Skip to content
GuidesBlogPlaygroundDashboard

Routing, Geocoding & Search

Compute routes, geocode addresses, and search by name within PlazaQL queries.

Use keyword arguments to specify origin, destination, and optional waypoints:

// Simple A to B
$r = route(origin: point(38.9, -77.0), destination: point(38.85, -77.05), mode: "auto");
// Multi-stop route with waypoints
$r = route(
origin: point(38.9, -77.0),
waypoints: [point(38.88, -77.02)],
destination: point(38.85, -77.05),
mode: "foot"
);

Routes are geometry objects — use them in spatial filters:

$r = route(origin: point(40.748, -73.993), destination: point(40.755, -73.970), mode: "auto");
// Find gas stations along the route
search(amenity: "fuel")
.around(distance: 500, geometry: $r);

Available modes: "auto", "foot", "bicycle".

Find the area reachable within a time limit:

// Everything walkable within 10 minutes
$iso = isochrone(center: point(48.85, 2.35), time: 600, mode: "foot");
search(amenity: "pharmacy")
.within(geometry: $iso);

The time parameter is in seconds. The result is a polygon you can use with .within().

Routes and isochrones can also be direct outputs. Named outputs are referenceable — $$.route is used as a value in the .around() call below:

$$.route = route(origin: point(38.9, -77.0), destination: point(38.85, -77.05), mode: "auto");
// $$.route is both an output and a reference used in the next statement
$$.nearby = search(amenity: "fuel")
.around(distance: 500, geometry: $$.route);
$results = geocode(query: "1600 Pennsylvania Ave, Washington DC");

reverse_geocode() — coordinates to address

Section titled “reverse_geocode() — coordinates to address”
$addr = reverse_geocode(point: point(38.8977, -77.0365));
Section titled “text_search() — full-text named entity search”
$hits = text_search(query: "best pizza", limit: 10, focus: point(40.7, -74.0));
$suggest = autocomplete(query: "coff", limit: 5);
$addr = geocode(query: "Times Square, New York");
search(amenity: "restaurant")
.around(distance: 300, geometry: $addr)
.sort(distance($addr))
.limit(count: 15);