I'm a little confused how to get the right markers to show up at a specific node using contextual filters.
I have 2 locations fields:
1 = geofield
2 = entity reference to a node that has a geofield.
This means when creating the node you can choose a geofield location or an entity referenced node or both. I created a block with the map that shows one of the two or both fields using contextual filters (content:NID) so that it only shows the right markers.
The problem is that it only shows the first selected field at the format settings when both fields are highlighted at 'Name of latitude field in Views query'. when I select one field is shows the marker(s) of that field so it works but not when I select two fields.
Hope someone knows the solution. Thank you
Comments
Comment #1
rdeboerHi QNDY,
Thank you for your interest in IPGV&M.
One thing I recommend to determine if this is a bug or not, is to add an Attachment display to your existing map View, showing the same result set as a table.
If your table shows two Geofields per row then you may have hit a bug in IPGV&M.
If your table does not show two Geofields per row, then you need to work on your View a bit more.
If there is a bug, and your site is small would you be able to use the Backup&Migrate module and send me a copy of your db? This type of bug can only be solved efficiently with a debugger running locally on my laptop.
Rik
Comment #2
rdeboerIf you are not seeing all entity refs, the patch from #15 in this Entity API issue may help: https://www.drupal.org/node/1378656#comment-5922278
Comment #3
QNDY commentedThank you for the quick reply. I cloned the block and deleted the relationship and contextual relationship. Now the block shows both node types. So I guess the multiple fields are correct in the map settings or maybe I am not fully understanding it. I put a screenshot with the view attachment viewed on the specific node that has one entity ref geo and 1 geo in the node itself.
Comment #4
rdeboerHi QNDY,
Thanks for the screenshot. So yes that looks good. You have two lat/lon field, one Geocode and one Gecode_Value.
Now I'd love to see your Views map setup and finally the resulting map where it all goes wrong...
That will give me a better handle on what goes wrong...
Cheers,
Rik
Comment #5
QNDY commentedHi RdeBoer,
This is the export of a clone with a block including the ref and contextual filter:
So the configurations are precisely the same as the first screenshot above but then of course with the map format. The second screenshot shows the settings of the map. I only selected the 2 fields and kept the rest the same. The block shows only the first selected field in the map settings. when deselecting the first field it shows the second field (non entity) and vice versa.
Thanks!
Comment #6
rdeboerHI QNDY,
Thanks for the above.
Big slap against the forehead!
What was I thinking? The option to select multiple lat/lon fields for the map came about for cases when people wanted to create maps with locations from different content types. So you might have a View that has Museums and Restaurants and for historic reasons these do not use the same field for lat/lon (hell, one may be using a Geofield while the other uses Location). So in that case, with each View result row pertaining to either a Museum or a Restaurant, the module will automatically pick up from each row the lat/lon field that is not empty.
The module was never meant to cater for your use-case, where one View result row has TWO locations on it to put on the map.
I'll have a look at what's involved to make this happen. Could be a biggy...
Rik
Comment #7
rdeboerJust checked in a mod that should give you what you are after. Try the latest IPGV&M 7.x-1.x-dev
See the screenshot below. The two yellow markers belong to the same View result row, labeled "CBD" in the table below the map.
In this example CBD is a term in a "Region" vocabulary. Each Region term has one or two Geofields attached to it. The first Geofield is the Centre of Region, the second is a Point of Interest in the region.
If a term has only one Geofield set, then only one marker will be shown.
Comment #8
QNDY commentedHi,
I just the dev and It works like a charm! Nice job and thank you for the quick replies and fixes!!
Comment #9
rdeboerYay! HIgh-five!