FacilMap / facilmap

FacilMap is a privacy-friendly, open-source versatile online map that combines different services based on OpenStreetMap and makes it easy to find places, plan trips and add markers, lines and routes to custom maps with live collaboration.
https://facilmap.org/
GNU Affero General Public License v3.0
321 stars 21 forks source link

`search=false` in embed url disables route #220

Open mcnesium opened 2 years ago

mcnesium commented 2 years ago

When disabling the search box in the embed code by adding search=false to the URL, the resulting embedded page also misses the actual route. Is this intended?

Screenshot from 2022-04-22 09-57-50

Example in Hedgedoc demo

Example code:

<iframe style="height:300px; width:100%; border:none;" src="https://facilmap.org/?search=false#6/51.340/9.140/Topo/n240109189%20to%20r271110%20by%20car"></iframe>

<iframe style="height:300px; width:100%; border:none;" src="https://facilmap.org/?search=true#6/51.340/9.140/Topo/n240109189%20to%20r271110%20by%20car"></iframe>
cdauth commented 2 years ago

The way it is intended is that the routing form is not shown. The purpose of this parameter is to embed a map into a website without showing the interactive elements of the search form, route form and POI form.

You are right, it would be better if the route was shown anyways if there is one defined in the URL hash. Right now the route is drawn by the form, which is why it is not shown.

How exactly would you want the route to behave? Would you want the start/end/via points to be draggable, and the route form still to be visible? Or should the route be immutable?

If the route should be immutable, I think the better way to do it would be to create a collaborative map, save the route as a line and then embed the read-only link of that map.

mcnesium commented 2 years ago

Both options are reasonable. What if the route is editable, whenever the form is visible? Maybe the search= flag should be changed to something like editable= then.

Side note: I just discovered facilmap when I searched for OSM-backed alternatives to the embeddable openrouteservice.org maps for a quick "this is where we are gonna go" visual inside a travel-plan notepad. Not sure if I am using this tool the intended way at all but it sure looks pretty neat. Thanks for sharing it :+1:

cdauth commented 2 years ago

I think it's a good idea to only have the route editable when the form is shown. In that case your embedded links should show the route, but it shouldn't show the route form.

Your use case sounds very much like what FacilMap is made for. I would recommend you to use a collaborative map for it, since then the route doesn't have to be recalculated each time, and also the route will still be shown if the routing service has a temporary outage.