Hi

Using Location Taxonomy, I'm able to set a location for every term in a vocabulary. Then I created a View of the taxonomy terms, and changed the View format to Gmap. I set the data source to 'Location.module'.

This produces the error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'latitude' in 'field list'

The query is:

SELECT taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_term_data.tid AS tid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name, latitude AS gmap_lat, longitude AS gmap_lon

As a test, I enabled Node Locations module and added locations to some nodes. Then I created a View of those nodes and set the format to Gmap. This works fine, and the query is:

SELECT node.title AS node_title, node.nid AS nid, location.latitude AS gmap_lat, location.longitude AS gmap_lon

The difference seems to be that the working view selects location.latitude instead of latitude, and location.longitude instead of longitude. I don't know how to change this in the module code to test.

Comments

dman’s picture

I got the same when trying to use a location field on a media entity (to map locations of images).
However I don't get it when using the same location field to map locations of nodes.

This makes me think that the location->views->gmap support is working for nodes, but is lacking for other entities. This would be common between a taxonomy+location view and a media_entity+location view.

Specifically, the node location map view could be built by adding the fields
"Location: Latitude (Latitude)"
"Location: Longitude (Longitude)"
And in the gmap settings, set Data Source: location.module.

However, when editing the view that shows my entities, only "Field: Location (Location)" is available

dman’s picture

Project: GMap Module » Location
Version: 7.x-1.1-beta2 » 7.x-3.1
Category: Support request » Task
Issue summary: View changes

The issue here is that location (location_cck) does not provide full entity-level database join support, so the query that gmap tries to make (on the assumption that a cck_location field allows us to retrieve the base node/entity) is failing.
The fix lies within location module, (found in location_cck 7.x-3.1) so putting it there in order to review a patch.

dman’s picture

Title: Column not found error creating Views map of taxonomy terms » Column not found error creating Views map of taxonomy terms (cck_location field attached to an entity not usable in views)
StatusFileSize
new4.36 KB

Attaching a vastly overdocumented patch that addresses todays problem.

It provides enough views table join hints to allow an entity (in my case file/media, but should also work for taxonomy etc) to be retrieved via location_cck field as used in gmap views.
There is more that is needed, such as exposing all the rest of the individual location sub-properties the way it currently works for nodes (maybe) and this patch is not clean. I'll now remove all my internal doc notes and provide a cleaned-up version. Just wanted the full analysis save in the issue here as it took me half a day to figure out.

dman’s picture

Basically the same patch with my explanation removed.

I'm pretty sure that I'm out of my depth here and that full and proper non-node entity support needs building from the inside-out, not through my experimental tweaks. THis just shows how far I could get this week, to get a result for a client.
As bigger work is happening in other dev branches, I don't expect this patch to go far.