geoadmin / mf-geoadmin3

Legacy source code of map.geo.admin.ch
https://map.geo.admin.ch
Other
227 stars 72 forks source link

Permalink crosshair after swisssearch not taken into account #4666

Open davidoesch opened 5 years ago

davidoesch commented 5 years ago

ALL OS ALL PLattform

open map.geo.admin.ch search for Seftigenstrasse 9 3007 Bern map zooms to swisstopo, balloon is shown use share link

paste share link

result; no balloon shown (https://map.geo.admin.ch/?topic=ech&lang=de&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege&layers_visibility=false,false,false,false&layers_timestamp=18641231,,,&E=2599538.00&N=1198738.00&zoom=10)

expected result: balloon shown

sth like https://map.geo.admin.ch/?topic=ech&lang=de&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege&layers_visibility=false,false,false,false&layers_timestamp=18641231,,,&E=2599538.00&N=1198738.00&zoom=10**&crosshair=bowl** (I woudl prefer the ballon

reported by @hpchrist

fun fact: with link to crosshair we support it

procrastinatio commented 5 years ago

We discussed this many times.

The thing is the marker has no coordinates of its own, and is placed on the center of the map. If you move the map prior to copy the URL, the marker is not placed where you wanted.

Using the right-click, the view is centered on the bowl (the point you just click), not the previous view.

davidoesch commented 5 years ago

I know we discussed this--- obviously we do not have a solution to grab the event to see if the marker is active. If marker is active and share link is activated--- add crosshair permalink parameter

gjn commented 5 years ago

To have this, the original idea was to use the swisssearch paramter. For instance, this gives you the desired results: https://map.geo.admin.ch/?swisssearch=Seftigenstrasse 90 3007 Bern&topic=ech&lang=de&bgLayer=ch.swisstopo.pixelkarte-farbe&layers=ch.swisstopo.zeitreihen,ch.bfs.gebaeude_wohnungs_register,ch.bav.haltestellen-oev,ch.swisstopo.swisstlm3d-wanderwege&layers_visibility=false,false,false,false&layers_timestamp=18641231,,,&E=2599538.00&N=1198738.00&zoom=10

The problem with this approach is that a) when address is not unique, then no marker appears and the dropdown list of the search and b) we can't share the result of a search

A way to solve this would be to introduce coordinates for the marker in the permalink. E.G. EMarker, NMarker. If not pressent, as current behaviour, if present, put marker at this coordinate. Then the application should make sure to keep track of those 2 coordinates (add it when marker is added via search, remove it when marker is removed, etc)

davidoesch commented 5 years ago

+1 for EMarker NMarker (google maps does solve this completely different)

davidoesch commented 5 years ago

" E.G. EMarker, NMarker. If not pressent, as current behaviour, if present, put marker at this coordinate. Then the application should make sure to keep track of those 2 coordinates (add it when marker is added via search, remove it when marker is removed, etc)" @pakb your thoughts?

procrastinatio commented 5 years ago

How do you remove the marker?

davidoesch commented 5 years ago

Good question: brainstorming

pakb commented 5 years ago

We could use the marker param and add some coordinate to it : marker=crosshair,46.63473,7.60423 for exemple. That will make it easy to track into shared links.

But that leave us with a problem, how do we remove a marker? On prod, if you reload a page after having moved just a little the map, the marker disappear. But that's the only way to make it disappear. We could remove it if it receives a right click, what do you think?

davidoesch commented 5 years ago

ping @gjn we shoudl decide here