Closed (fixed)
Project:
Geocoder
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2012 at 00:37 UTC
Updated:
17 Aug 2012 at 20:51 UTC
Using Location+Gmap I was used to automatic geocoding based on my address but then I was also able to move the pinpoint in the map to a more accurate position (and IIRC Location was storing also the map zoom).
So, while editing an entity I'd like to have a map and be able to specify if I want it to be automatically geocoded or if I want to set a specific position on the map, or something similar.
This issue will be fixed in the geofield module here #1627940: Add optional geocoding to map input widget Please review and post there!
Comments
Comment #1
thlor commentedI think Conditional Fields may be a dirty but working solution.
Comment #2
hnln commentedGeofield has the same request: http://drupal.org/node/1308510
Comment #3
michaelfavia commented@thlor: are you using conditional fields to expose the geofield map input and disable the geocoding?
@hnln: This is an interesting suggestion/request. Geofield stores the WKT/LATLON and openlayers is the input widget you seek. I've often run into the same issue and would like this functionality myself.
As the inheritor of this module I am interested to know if a "refine geolocation option" might be valuable to reexpose the geofield imput map if we already have a location stored or something similar. Thoughts?
Comment #4
bago commented@michaelfavia the "refine geolocation option" could be a good improvement. The best thing at all would be to have geocoding to happen in ajax and to automatically locate the point in a map widget and then use the map widget to submit a point (and if you don't have ajax/javascript then you revert to allow geocoding on save and refine later or simply choose the location on the map on the first save and not use geocoding at all). I don't know how doable this is, but I guess this is what people used to location+gmap expect.
Comment #5
michaelfavia commented@bago: thx for feedback
Ok then. Lets say we go ajax route. We currenlty geocode from pictures, files with gpx info, address_fields and regular text fields. Ar eyou proposing that we only perform the ajax look up on lose focus of the textfeilds and address fields? Ping the geocoder service on the lose focus event of each text area?
What happens if you adjust the point on the map further by hand and then update your address field (be it body, addressfield, or other) after that? Does it revert tyour map point or keep your manual adjustment.
Comment #6
bago commentedThis is a good question. I'd say that once you changed it "by hand" then geocoding should not change it anymore. But then it would be good to have a way to say "forget my custom location and start automatically geocoding again!"
I don't know how things are currently stored (I didn't dig the code or the db for this issue) so I don't know if you currently have a way (once saved and reloaded) to know if the coordinates have been automatically geocoded or if they have been manually inserted pinpointing a map.
Comment #7
hnln commentedI'm not a fan of the ajax approach as geocoding should happen in hook_field_attach_presave as otherwise you don't get any geocoding when you programatically save, batch save (vbo) or import content with addresses (and those are quite common to import :-), see also http://drupal.org/node/1297654 and http://drupal.org/node/1417078.
I'm also not a big fan of the location approach, it cluttered the form too much (address fields, map, some explanations a checkbox to delete location that confused people, ...).
'Refine geolocation' sounds good to me :-) Maybe a checkbox as mentioned in the geofield issue and if checked the form will display again on submit but this time it will also show the map widget. We should make sure then that the automatical geocding doesn't happen when map widget is used and a way to remove it as well.
Comment #8
bago commented@HnLn: I hoped we could get on the fly AJAX support while retaining the features for the vbo/import/presave.
The use case is that you are adding a new node, you enter the street/city and then you want to know ASAP if the geocoding know what you are talking about, otherwise you have to manually set the position. If you don't use AJAX you ask users to save and look at the result, edit to refine and save again. It is a lot of work if geocoding fails often (I saw it failing 30% of cases in my current site, and another 30% needs refinement anyway.)
Comment #9
pribeh commentedYa, we had this setup on a d6 client site and the real advantage for users was when they were able to see immediate results, ie ajax. The user needs to see the map locate based upon text field address input and vice a versa immediately, otherwise this is not a useful feature. This is the same reason autocomplete is so handy. Like bago alludes to, this is about reducing user error.
Comment #10
okeedoak commentedI agree: use ajax but keep vbo/import/presave.
Comment #11
phayes commentedThese should be two different widgets: first-widget should be as-in, the second-widget can be ajax.
Comment #12
phayes commentedComment #13
phayes commentedThe first step is to do this: #1462364: Provide AJAX service
Comment #14
phayes commentedNow that we have our AJAX service we can proceed.
Long-term we need to wait until this issue is resolved in geofield: #1273802: Geofield/Openlayers widget refactor as we would want to base any really good, general purpose interactive widget on geofield's new openlayers map widget.
However, short-term I would be willing to accept a patch that does google maps to get SOMETHING in place. This should go in a new sub-module. (Called geocoder_interactive ??)
Comment #15
pribeh commented@phayes #14, what about using leaflet? project/leaflet
Comment #16
phayes commentedLeaflet would also be great. It looks like they have a feature-request out for a widget: #1284932: Leaflet field input widget . Once they build a widget perhaps we can riff off it for our geocoder powered version.
Comment #17
pribeh commentedK, I'll see if I can get some to help jump start on the widget.
Comment #18
henrijs.seso commentedIn general idea - geocoding + manual adjustment in one form - is good, because it would potentially allow feeding changes back to geocoding providers.
I think editing address would do re-geocode, since address can be changed significantly, some smart proximity check could be made to determine severity of address change or default behavior would be set by field settings.
Comment #19
mieg commentedi tried using conditional fields but didn't get it to work. How would you do this? i made a 'geolocated' field and tried to update the location field when this was filled, but wasn't able to fill it with the value of the dependee.
Comment #20
phayes commentedComment #21
nedjoI hadn't found this issue before I implemented a workaround in #1585804: Optionally support direct digitizing of locations, using
hook_field_widget_properties_ENTITY_TYPE_alter()to dynamically switch the widget through an AJAX call. Possibly that approach could be generalized, but there would be a number of issues. E.g., getting the settings required for the different widgets would be difficult.Comment #22
nedjoThe workaround in #1585804: Optionally support direct digitizing of locations works but has a lot of moving parts.
To reduce the complexity I sketched in a possible approach in #1627940: Add optional geocoding to map input widget.
My thinking is:
Not sure how sound either of these points are. Happy for comments and review.
Also posted two related issues:
Comment #23
giorgio79 commented1. Related issue, probably this issue would be dependent on this as well: #1461164: Reverse-Geocode support
Adjusting the marker manually on a map would require reverse geocoding, since the mapping service needs to provide an address based on lat long..
2. Sometimes, an ambiguous address field input may yield multiple results on the map. A "Did You Mean" feature would be great as well, for example:
http://econym.org.uk/gmap/didyoumean.htm
Comment #24
phayes commentedWe will be tackling this issue in geofield here: #1627940: Add optional geocoding to map input widget, not in geocoder module. All comments etc should go there. I will keep this issue open as a pointer
Comment #25
phayes commentedThis is now fixed. See geofield module.
Comment #26.0
(not verified) commentedsdf