Routing, Geocoding & Search
Compute routes, geocode addresses, and search by name within PlazaQL queries.
Routing and navigation
Section titled “Routing and navigation”route() — point-to-point routing
Section titled “route() — point-to-point routing”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 routesearch(amenity: "fuel") .around(distance: 500, geometry: $r);Available modes: "auto", "foot", "bicycle".
isochrone() — travel-time reachability
Section titled “isochrone() — travel-time reachability”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().
Using route results as outputs
Section titled “Using route results as outputs”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);Geocoding and search
Section titled “Geocoding and search”geocode() — address to coordinates
Section titled “geocode() — address to coordinates”$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));text_search() — full-text named entity search
Section titled “text_search() — full-text named entity search”$hits = text_search(query: "best pizza", limit: 10, focus: point(40.7, -74.0));autocomplete() — search-as-you-type
Section titled “autocomplete() — search-as-you-type”$suggest = autocomplete(query: "coff", limit: 5);Combining geocoding with spatial queries
Section titled “Combining geocoding with spatial queries”$addr = geocode(query: "Times Square, New York");
search(amenity: "restaurant") .around(distance: 300, geometry: $addr) .sort(distance($addr)) .limit(count: 15);