G'Day fabulous geofielders,
Apologies but I'm having trouble locating my usecase within what seems to be an ideal solution described here: http://drupal.org/node/1627940
1. I have a node with an addressfield to capture venue location.
2. Geofield is set up to geocode from this field, and pass the info to Yahoo Placefinder.
3. The resulting lat/lon that comes back is pretty useful, but often needs adjustment.
4. I want to allow the node author the ability to go to [Edit] mode on the node, get to the address field, and see the option to pop up a geofield *input* map which allows them to refine their location.
5. On save, the user's lat/lon are stored in GeoField instead of the results automatically sourced from Yahoo.
Right, so the feature thread pasted above seems to address this usecase, but I'll be darned if I can see how to actually get the geofield input map to appear in the node edit form at point (4) above.
Thanking you in advance for the necessary clues: I promise to either promote or write the documentation for the above!
Kind regards,
JB
Comments
Comment #1
phayes commentedHi JB,
If you install the openlayers module along with geofield and geocoder, you should see the widget "OpenLayers Map" for geofield, within that widget settings, you should see options to enable geocoding as part of the map widget.
Comment #2
Brandonian commentedMarking as fixed.
Comment #4
boabjohn commentedHi guys,
Thanks for the response, and apologies for the long pause. Probably like you I only have time to dive in on these things once in awhile, intensely, then off to other demands.
So going to my node definition, there is:
1. address field: captures and stores the nice information a user expects to provide for a venue
2. geofield: stores the geospatial details in a spatially friendly format.
From a UX perspective, we want the user to start with (1) address field. They fill in information and hit submit.
Behind the scenes, we had geofield looking at addressfield and geocoding from that information provided. Usually this works a treat, and we get the benefit of human-readable address details to display in non-map interfaces. Addressfield is good.
But sometimes geocoder can not get a good match on the address. So the user is presented with a mis-placed location.
Now, the user needs to go edit their location using a map to drag a point around manually.
To acheive this, you suggested that I change the widget settings on the geofield so that instead of geocoding from the Addressfield, we use a map input. So I changed the widget settings to OpenLayers map.
But I'm confused as to the UX intent.
We expect the user to go to node [edit], skip past the Address field, and find the Geofield map. There is no toggle or other control to say explicitly: "Use this map as the geocoding source".
There's already a point on the map. There's no obvious way to edit this point's position. We click the toolbar for (point +) and we can ADD a new dot...but the old point stays fixed. Now there's no way to delete a point and we have two.
Ok, so mess this is largely a result of changing the widget type...I'll have to find a way to massage all the existing nodes.
Back to the main story...let's create a new node. And see what happens. First, we enter a well-known address in the Addressfield produces no spatial details in the geofield at all...since we've changed the data source to the OpenLayers Map. The user would be expected to enter the Addressfield data AND explicitly set a point location for every node, which completely leaves out the power of the geocoder...we're back to manual maps.
So. Unless I'm missing the obvious, it doesn't seem like we can use the Addressfield's nicely structured information in the first instance as a geocoding source, and use a map to override that information *if needed*.
Thanks for your patience in reviewing this...I hope this is not an 'edge usecase' but simply a failure on my part to understand how to properly use these amazing tools to get the job done.
Kind regards.
Comment #5
greenskunkHello Boabjohn,
Being that I'm a relative newb to Geofield, I had setup a geofield with all of the available features and created an issue where users could create more than one point and draw on the map and NOT reset the point currently on the map. So first I recommend checking your content type's fields' settings (Addressfield and Geofield).
Please note that your setup may vary.
Go to Administration->Structure->Content Types->[ContentTypeHere]->Manage Fields
Review Addressfield settings
Label:Address, Field Type: Postal Address, Widget: Dynamic Address Form
Review Geofield settings
Label: Geofield, Field Type: Geofield, Widget: OpenLayers Map
Click "edit" to check your geofield's settings
OpenLayers Map: Geofield Widget Map
Storage Options: Store each simple feature as a separate field.
Available Features: Point
Allow Shape Modification: Checked
Geocoder settings
Enable geocoding of location data: Checked
Geocode from field: Address
Geometry Type: Point
Geofield Field Settings
Number of Values: 1
2 important setting changes I made to geofield were:
I hope you made the same mistake that I did and enabled too much.
Have fun!
Jeremy
Comment #6
boabjohn commentedHey there Jeremy,
Thanks heaps for the reply. I might have fallen off at one point in the setup though...can you clarify where you're selecting the Geocoder settings? Under /admin/config/content/geocoder > I'm only finding API settings for Yahoo. Under /admin/modules/geocoder > I'm not seeing a link for configuration.
Sorry...it's probably obvious: if you have a moment to clarify much appreciated!
Then I'll be able to follow along with your example and see if it actually resolves this usecase.
Thanks indeed.
Comment #7
greenskunkHello @boabjohn,
I'm referring to your content type's Geofield field's settings.
I apologize as I thought you had already setup your content type with an Addressfield field and Geofield field. The Geocoder project page has a link to an instructional video on using OpenLayers, Geofield, Addressfield and Geocoder produced by DrupalOverEasy.com
Geocoder will default to using Google's geocoder API v3 which does not require an API key (See https://developers.google.com/maps/faq#geocoder_limit). In other words, you don't need to enter an API key at Administration->Configuration->Content Authoring->Geocoder settings.
I do recommend the book, Mapping with Drupal to get more familiar with mapping and Drupal. Though it is probably out of date by now, it is a quick read and a great start to understanding mapping with Drupal.
Comment #8
Exploratus commentedIs there a way to make the map geocode on node save, just as the geofield does? THis was the funtionlity for geofield map in Drupal 6. In cases such as ours, were we import hundreds of nodes at a time, we need to be able to geocode on node save.
Comment #8.0
Exploratus commentedcorrect minor typos
Comment #9
nchase commentedthe setup works till a certain point.
When a user enters an address into the address field and than uses the "find using Address field" the map has to be huge to show the point on the map - because there is no zoom to layer option for the found result. It is a show stopper as you can't expect people to search the hole map for the point ...
Comment #10
rick hood commentedQuestion: the open layers library is pretty large, do I need all of it for this use case?
I followed the "right way" method of getting the library shown here: https://www.drupal.org/project/openlayers The entire library folder (OpenLayers-2.13.1) is 74.2 MB unzipped.
Do I need everything that is in there for this use case? I want to be able to use local JS instead of this: http://openlayers.org/api/2.13/OpenLayers.js (see settings: admin/structure/openlayers). By the way the main reason I need to do that is that http://openlayers.org/api/2.13/OpenLayers.js won't load when I am https on my Drupal site, maybe there is another way around that? It works fine on http.
This is error on https:
Mixed Content: The page at 'https://www.mysite.com/node/1720/edit' was loaded over HTTPS, but requested an insecure script 'http://openlayers.org/api/2.13/OpenLayers.js'. This request has been blocked; the content must be served over HTTPS.My use case is only to be able to have an open layers widget for geofield to set a location of a node in case the geofield module cannot get the coordinates from the address field (the subject of this issue).
Or, should I not worry about it and just put the whole 74MB up there in the libraries folder? Seems like a lot of bloat is all.
Thanks,
Rick
UPDATE:
OK I realized that a huge part of the size of the open layers library is the docs folder which was 50.5 MB. I got rid of that folder as well as these others:
examples folder (4.1 MB)
tests folder (5.8 MB)
tools folder (147 KB)
It all works fine without those folders, so all set.
Open Layers library running locally now, so no https problem anymore.
Comment #11
diego.paroni commentedGeolocation Field provides a Google Maps input widget for Geofield.
https://www.drupal.org/project/geolocation
Comment #12
thechanceg commentedThe comments by GreenSkunk got me really close to accomplishing my goal of using the openlayers map option for allowing admins to fine tune the Geocoder results. Unfortunately, that broke auto-geocoding on programmatic node creation. It turns out the Geocoder module only updates fields that are using the 'geocoder' field widget. Even after setting the 'geofield_openlayers' widget to Geocode From A Field, and selecting my Addressfield field.
A workaround I found was to copy Geocoder's hook_field_presave function into a module, and change which widget it is looking for:
Hopefully this saves someone some time.