Closed (fixed)
Project:
Geolocation Field
Version:
8.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 May 2016 at 12:27 UTC
Updated:
28 Sep 2016 at 15:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
stella commentedComment #3
derjochenmeyer commentedPatch does not apply anymore after last commit.
Comment #4
stella commentedAttached is a re-rolled patch against latest HEAD. There are some changes in this patch however:
First, for the recently committed map control configuration bits - I moved the rendering of them above the handling of the 'center' setting, as that section can return prematurely in some cases, causing the following code (which sets the map control visibility settings) not to be executed. This was affecting my icon settings too, so fixed it for both here.
Secondly, I changed how this patch worked. There is now a textfield in the style settings where you can configure an absolute url to a marker icon as before. This is the default marker. There is also a drop-down matching fields in the view of type 'file_uri'. This means users can add a file uri field to their view (might be an icon stored on a node, or on an associated taxonomy term as in my case) and that icon uri will be used instead of the default marker.
FYI, to add an image uri to the view (cos this took me some time to figure out):
1. Create your content type with an image field and location field.
2. Create your geolocation view, with title and geolocation as fields on the view as normal.
3. Add a relationship to the view on the image field for your content type.
4. You will then see a new 'File' group when you go to add a field - and there you should be able to add a 'File: URI' field and set the Relationship drop-down to the relationship you've just added.
5. Edit the style settings and configure the file uri field for the 'Marker icon field' drop-down there.
6. Save and clear cache if necessary.
If some rows do not have an icon uri returned (e.g. no image attached to the node), then the default marker will be used. If the default marker field is left empty, then Google's default red pin marker is used.
It'd be nice as a further extension to be able to configure different markers for different content types, but I'm not sure how to approach that just yet and this is a good first step.
Comment #5
stella commentedOk, one last version of the patch. I figured after allowing users to customise the markers used per result row, it might be nice to display a legend if needed.
To do this I followed the Google Maps API guide at https://developers.google.com/maps/documentation/javascript/tutorials/ad... and then added some more settings to the style. There's a checkbox to enable display of a legend, along with settings to position it and specify a 'string' field from the view fields to use as the legend text. The legend appearing is dependent on there being an icon field set, as it doesn't make sense otherwise.
Comment #6
screon commentedJust like support for styled maps, I need this one as well. I'll try it out and post back my findings.
Comment #7
screon commentedThe patch applied, but I can't get the icons working. The images appear to be broken becasue the src attribute points to "public://...". When I change this in my browser to a relative path ("sites/default/files/..."), the icons appear.
Do you encounter the same problem?
Comment #8
stella commented@screon there is a checkbox in the "File: URI" field called "Display the file download URI". That needs to be enabled too to get the absolute url. Sorry, forgot that bit.
Comment #16
a.sinitsa commentedHi!
Patch does not apply to latest dev
Comment #17
christianadamski commented@stella I highly appreciate this approach. Let the user select an image field for the icon. This way, a taxonomy could be pulled in well. Maybe add a selection for the image-style as well.
However: all the google map settings are outdated and need to be removed.
Comment #18
christianadamski commented- select any image field as icon
- image style will be used
- unrelated: made geolocation field #required
- unrelated: added "none" option to title field
Comment #20
christianadamski commentedComment #21
a.sinitsa commentedHi! Thank You!
But what if I need to use not image field?
For example: I need the map with users. Different user roles should have different icons. In views I create field with role id, overwrite it to output like image:
<img scr="/images/icons/role-icon-[role id].jpg" />and wanted to use this as icon in map.
Comment #22
christianadamski commentedHey,
how would you like this to work? Create a new issue as feature request.
Ideally you could use some kind of taxonomy with an image field, but I also have no idea how to do in this context.