Question

i would implement a Map on my Homepage. It should display a route from a fix start point to a variable end point.

We have a database (mysql) which contain adresses (Street and number). And thats the only way to determine the two points

I have completely no idea how to do that. is OSM (OpenStreetMap) a good way to do that? But how can i get coordinates from a adress ...

Was it helpful?

Solution

Yes, OpenStreetMap is one possible way of solving your task.

To embed a map based on OSM you should either stick to Leaflet or OpenLayers. Both offer slightly different features but are easy to use. And both can easily display a GPX file (your route) as an overlay on top of the map.

For calculating this route you can choose from one of the many online routers, offline routers or just stick to a library.

Similarly OSM offers a way to convert an address to coordinates. This is called geocoding and can be done using Nominatim.

Remember to check the usage policies if you decide to use any of the web services (routing, geocoding, tiles). For most of these services there are alternative instances available which are run by different companies and have less-strict usage policies. And of course you can also run your local instances of most of these services if you like.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top