Closed (fixed)
Project:
Geolocation Field
Version:
8.x-1.x-dev
Component:
Geolocation field
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2016 at 13:57 UTC
Updated:
30 Dec 2016 at 18:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
christianadamski commentedComment #3
juliencarnot commentedHi Christian,
Do you envision these "missing" features as alternative settings or as a replacement for the current dev feature? It seems like there could be 2 different modes:
In my use case, I want to set the location by default, as soon as possible and without requiring the user to click/tap to use it (of course, the user can discard the feature by not sharing his location in the browser UI), to give her a visual indication of the accuracy of the position (a disc on the map) and allow her to call the position again (to get a better accuracy) or to set the right position (the disc disappears when the marker is moved by the user or when the marker is set from search). This seems to cover the described features pretty well.
I got this to work through this old patch, you can try it here.
Do you think these two modes could coexist through an "autolocate" or "autofill with user position" option in the form display settings for the content type? Thanks for your insight!
Comment #4
christianadamski commentedHello Julien,
good to hear from you. This issue is just a copy of what @derjochenmeyer noticed as missing compared to D7.
I think the current super-simple mode could stay as default, but the widget settings allow for more fancy behavior.
So if you build a patch that leaves the default as is, but adds your functionality based on a widget setting, I'll be happy to commit it. Ideally, you would build this in a way to en-/disable the single features separately.
All default "No":
[ ] Set marker when client location available
[ ] Visualize accuracy estimation on map
[ ] Allow drag'n'drop of marker
That last option seems independent of the client location though, right?
Thank you,
Christian
Comment #5
derjochenmeyer commentedoptions sound great. every site will have its own requirements.
- center on pageload yes/no
- show center on click button yes/no
- show accuracy yes/no
- show marker yes/no
- allow readjusting the marker yes/no
- reverse geocode the marker/center and show closest address info yes/no
- autozoom depending on accuracy yes/no
Comment #6
EWB commentedRegarding the "allow readjusting the marker" feature - and as you may already know - it appears that the Geolocation OSM sub-module has this functionality in place. While realizing that the code may not be swappable, I thought it worth noting in case it helps this module's maintainers move this (awesome) module forward.
Comment #7
christianadamski commentedHey, see #2804385: Add default center option for Geolocation Google Geocoder.
Takes care of:
- marker is set if value is present
- use client location if available
- adds new: default lat lng when no value set yet
Comment #8
derjochenmeyer commentedSo we could update the description of this issue and tick off some of the missing features?
Comment #9
christianadamski commentedComment #10
juliencarnot commentedI tested both modes in the latest dev version (centering and setting value) and found 2 issues with the latter mode:
The following patch also include enhancements for the setting value mode: if using HTML5 location to set the marker, a circle representing the accuracy of HTML5 location is drawn and the map viewport is bound to it, so that the user can tell if the position can be trusted and can adjust it easily. The circle disappears when clearing the geolocation values or when moving the marker manually.
I think this on top of the latest dev version would solve the remaining points listed in the issue (if backported to D7 version).
Comment #11
juliencarnot commentedComment #12
christianadamski commentedHey, thanks for your Code. Only on my phone right now, not really able to review.
On first look though: you added the circle magic to geolocation-geocoder.js?
The idea there is to separate the geocoder JS from Google. You know, so other people can use this module without Google.
Can you move that code to the Google specific one?
Comment #13
juliencarnot commentedThanks for your quick feedback!
The "circle magic" is in geolocation-geocoder to apply on locate button click and in geolocation-widget-googlegeocoder to apply on load. I'm sure there's a better way to avoid code duplication and I understand the logic behind separating Google from the geocoder JS and I'm looking forward to alternative maps, but it looks like geolocation-geocoder is still full of Google Maps API features. I guess geolocation-geocoder should call a getAccuracy function on locate button click, the function being declared in geolocation-widget-googlegeocoder for google maps and/or in another future js with the same feature for mapbox or leaflet, is that it?
I guess I should seriously learn to code for that, I gave it a run through my usual observation/trial/error process and couldn't get it to work, really sorry about that!
Comment #14
dharam.sharma1991 commentedHi Christian,
When we can expect a release with these new features. I am also looking for the same kind of functionality, where marker location should be captured automatically and user allow to change it.
Thanks
Comment #15
juliencarnot commentedHey Christian,
I realized that one of your recent commits had "cleaned" geolocation-geocoder.js from Google Maps references, so it was much easier for me to put the "circle magic" in a cleaner patch. Thanks for the help on that!
I've tested it on the latest dev with different settings and use cases, and it works well for me.
Comment #16
christianadamski commentedHey @juliencarnot,
I took your patch and reworked it a bit. I generalized it into a function not tied to the widget. It also draws the circle and then fades it away 2,5s. I think its fancy. That's why I also added it to CommonMap display.
Comment #19
christianadamski commented@juliencarnot I missed that nice little circle zoom trick. Added.
I assume that we have surpassed D7 functionality now and will close this issue.
If I missed something, reopen it or just open a new ticket.
Comment #20
christianadamski commentedComment #21
juliencarnot commentedThanks Christian, sounds good, especially with the zoom trick ;-) !
A few remarks after testing, with "Will use client location automatically by default" and "Will set client location marker automatically by default" set on my widget:
Comment #22
christianadamski commentedHey @juliencarnot,
It's not a bug, it's a feature. The behavior before was wrong. Default values are set in the fields settings. The lat/lng in the widget settings only influence the map, as the description there also states.
I hope it's a caching issue. If it happens again, re-open.
Comment #23
juliencarnot commentedHumm, sorry if I haven't been clear. I agree about the change for default value from widget to field and the default value not setting the marker/inputs anymore, but we have 2 modes for the setting, as described in #3 and controlled by these settings in t:
I have both settings on, and the resulting behaviour is what I expect from the first option alone. In fact, I can't see a difference of behaviour whether "Automatically set marker to client location as well" is checked or not. Am I missing something?
Can't see the js error so it was probably some cache issue.
Comment #24
christianadamski commentedAh, good find! The code there was correctly triggering and correctly setting the initial location.
However, the whole client location stuff is executed much later and the map was already loaded at that point.
Asynchronous Javascript and stuff.
I'm pushing the fix together with #2829159: Compact and descriptive UI for Google Maps geocoder widget and leave this closed.