We aim to establish a bus line in our city and are exploring various mapping APIs. A friend suggested using Google Maps API. Our objective is to compute the distance in meters between two locations. I encountered the method calculateDistance(), but it only provides airborne distance rather than street distance. We have a database of addresses and need to match one of them with a user-provided location to identify the nearest address. Thus, we require a way to evaluate the shortest distance from the user’s location to each address in our database.
One option that often gets overlooked is using the OpenStreetMap (OSM) data along with tools like the OpenRouteService API. This service utilizes OSM data to calculate route distances along roads instead of just straight lines. It’s particularly beneficial if you’re looking for a cost-effective solution as OSM data is open-source. OpenRouteService also offers various additional routing options including public transport modes, which could align well with your bus line project’s needs. Give it a shot and see if it suits your requirement.
Hey, try using the ‘Directions API’ from Google Maps. It gives you route distance and time using real road data. This way you get exact street distances. You’ll reqire an API key and might need to handle HTTP requests in your code. Hope this helps!
If you’re looking for alternatives to Google Maps, you might want to explore the Mapbox Directions API. This API not only provides distance based on road data but also allows for different modes of transport like walking, cycling, or driving, which could be useful depending on your bus route requirements. I’ve used it in a project before and appreciated the flexibility it offered in terms of route customization. You’ll still need to handle API keys and requests but the documentation is quite helpful.