Open baffioso opened 1 year ago
@jschristensen tempting to enable in-app directions
curl -o mapconfig.xml https://raw.githubusercontent.com/pgRouting/osm2pgrouting/main/mapconfig.xml
brew install osm2pgrouting
supabase start
) and create routing
schema for the data and enable pgRouting extension
create schema routing;
create extension pgrouting;
supabase status
)
osm2pgrouting -f denmark-latest.osm -c mapconfig.xml --schema routing -d postgres -U postgres --port 54322 -W postgres
✅ Done
TODO: Download smaller OSM area (Copenhagen). No need to process all Denmark
Currently user get redirected to google maps for directions. pgRouting is available as extension in Supabase and could be used to generate in-app directions on the map. A postgres function with
from
andto
coordinates as arguments can return route as GeoJSON LineString. This function can be exposed to the app using rpcTo setup pgRouting OSM data needs to be imported and processed in postgres.
Import https://pgrouting.org/docs/tools/osm2pgrouting.html https://osm2po.de/
Getting started https://www.crunchydata.com/blog/routing-with-postgresql-and-crunchy-spatial https://mapscaping.com/getting-started-with-pgrouting/