Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be cool if a mobile visitor could see his position marker moving in real time similar to how it's done in Google map. Is something like this possible with ip_geoloc? If not please consider adding such a feature. ^^ I've done some goggling and found watchPosition option, http://leafletjs.com/reference.html#map-locate-options , in Leaflet should enable this feature. How should I go about enabling watchPosition in ip_geoloc?
Comments
Comment #1
tkittich CreditAttribution: tkittich commentedComment #2
tkittich CreditAttribution: tkittich commentedI've found Leaflet.Locate https://github.com/domoritz/leaflet-locatecontrol that should work nicely. According to https://drupal.org/comment/7062258#comment-7062258 , extract Leaflet.Locate in a theme and override the template ip-geoloc-leaflet.tpl.php by adding the follow code seems to work great with leaflet maps. ^^
Comment #3
RdeBoerThis looks great tkittich!
Must try when I find some time.
Rik
Comment #4
RdeBoerSee also #1924030: Marker for Visitor Location that Updates with Movement (for OpenLayers).
Comment #5
kipper CreditAttribution: kipper commentedHi!
I tried it and it works well!!! But I have a problem to solve:
The button turns white, and the icon of the marker is missing.
Even in the demo (demo_mapbox) library "leaflet-locatecontrol" downloaded from here: https://github.com/domoritz/leaflet-locatecontrol icon is missing.
I investigated for hours but I can not solve this problem
Any help / suggestion?
P.S. I tried several options in sight and I discovered that the script (trick :)) of tkittich overwrites the template "ip-geoloc-leaflet.tpl.php" but fortunately the button "Add a full-screen toggle to the map" (activated in the view) it is shown.
The other options even if activated are overwritten and are not shown:
- Add an imperial (miles) scales
- Add a metric (km) scales
- Add an indicator showing the active zoom level
- Add a reset button
- Add cluster toggle button
- Enable mini-map inset
...but for my project goes well that is displayed:
- Add a full-screen toggle to the map
It is the only one that is NOT overwritten !!!
good trick tkittich !!!
Many Thanks
Comment #6
dwadson CreditAttribution: dwadson commentedThe button is white, with no icon, because it requires the Font-Awesome css. Either need to load it in that overridden template, or use custom markers in the view.
But still doesn't address the other options being overwritten and not shown...
Comment #7
abdolmaleki CreditAttribution: abdolmaleki commentedThe other options even if activated are overwritten and are not shown:
- Add an imperial (miles) scales
- Add a metric (km) scales
- Add an indicator showing the active zoom level
- Add a reset button
- Add cluster toggle button
- Enable mini-map inset