This application provides a routing API for finding routes between origin and destination locations using both OSRM and OSMnx backends. It also includes a simple Angular frontend that allows users to select locations on a map and displays detailed route steps with arrows.
- Routing API: The application provides a robust routing API that supports both OSRM and OSMnx backends.
- Location Selection: Users can select origin and destination locations on a map using the simple Angular frontend.
- Geocoding: The app supports location-to-address and address-to-location conversions.
- Route Visualization: The application displays detailed route steps with arrows to help users visualize their journey.
Before running the Routing Application, ensure that you have the following prerequisites:
- Node.js
- Python
- OSRM Backend (running and configured)
- OSMnx (Python library)
To install the application, follow these steps:
- Clone the repository to your local machine.
- Download the required OSM data for use with OSRM and OSMNX.
- Install the necessary dependencies by running
npm install
. - Install the necessary Python dependencies by running
pip install -r requirements.txt
.
To use the Routing Application, follow these steps:
- Configure the application settings in the
config/default.json
andconfig/test.json
files. - Start the OSRM backend and ensure it is running and configured correctly.
- Start the application by running
npm start
. - Access the application through the specified URL or port (e.g.,
http://localhost:55000
). - Use the simple Angular frontend to select origin and destination locations on the map.
- Choose the desired routing type (OSMnx or OSRM) and any additional options.
- Click on the "Calculate Route" button to generate the route and view the detailed steps with arrows.
- Access the API endpoints:
POST /routing/osmnx
- Body parameters:
origin
: Origin coordinates (latitude, longitude)destination
: Destination coordinates (latitude, longitude)
- Body parameters:
POST /routing/osrm
- Body parameters:
origin
: Origin coordinates (latitude, longitude)destination
: Destination coordinates (latitude, longitude)
- Body parameters:
- The API response will contain the calculated route, travel distance, and travel time.
Please ensure that the OSRM backend is running and accessible when using the osrm
routing type.
The application includes test cases that can be run using Jest. To run the tests, execute the command npm test
. This will run all the defined test cases and provide the test results.
To test the availability of OSRM and OSMnx services, you can set the following environment variables in a .env
file:
NODE_ENV=development
OSRM_SERVICE=true/false
OSMNX_SERVICE=true/false