This patch adds support for Views 2 to join location tables to views where term_data is the base table.

Files: 
CommentFileSizeAuthor
#30 views3-taxonomy_term_data-support-429548-30.patch1.21 KBbmcmurray
PASSED: [[SimpleTest]]: [MySQL] 425 pass(es).
[ View ]
#17 location_taxonomy-views-429548-17.patch5.59 KBrooby
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch location_taxonomy-views-429548-17.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#16 location_taxonomy-views-6.x-3.1.patch4.88 KBthinkact
PASSED: [[SimpleTest]]: [MySQL] 425 pass(es).
[ View ]
#1 location_taxonomy-views.patch4.27 KBbangpound
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch location_taxonomy-views_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
location_taxonomy-views.patch3.95 KBbangpound
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch location_taxonomy-views.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

bangpound’s picture

Title:Let views see location data for views with term_node as base table» Views 2 should join location and term_data table when using location_taxonomy.module
StatusFileSize
new4.27 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch location_taxonomy-views_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Whoops. That was a bit backwards. The previous patch only supported views where location was the base table. This patch goes both ways: location as base table and term_data as base table.

YesCT’s picture

tagging. :)

related/duplicate of #260726: Combining Location module with Taxonomy

bangpound’s picture

Yeah, it's not a duplicate. This is a specific issue with a patch! Please don't close it!

Summit’s picture

Subscribing, looking forward to this!
greetings, Martijn

SocialNicheGuru’s picture

subscribing

scottatdrake’s picture

subscribing

redraven’s picture

Hi Bangpound,

I found this issue and your patch when trying to figure out how I could display locative data associated with a term in a view.

I applied your patch and have taken a look at the code changes.

I have some experience with relationships in views 2, but I'm having issues getting my view correctly configured to take advantage of the views integration.

My goal is to display lat/long of location information associated with a specific term in a view.

I was hoping that you could provide some brief documentation of how to do this, or if that is what this patch allows.

I have a feeling I might be missing something with the configuration of the relationship in my view, any advice on how to get this properly configured would be greatly appreciated.

Thanks for offering up this patch and working to improve views integration with location taxonomy.

solona’s picture

subscribing.

bangpound’s picture

The patch is in comment #1.

redraven’s picture

I've applied the patch and was struggling to get the view properly configured to take advantage of it.

Any quick tips on how the views relationships need to be setup to grab the location data associated with the term?

Thanks

Summit’s picture

Subscribing, greetings, Martijn

morningtime’s picture

I dont think this patch works.

What I need is:

1. a term has a location via location_taxonomy
2. a view with tid as argument
3. show location for that term

Very simple. But what you get is this:

SELECT location.latitude AS location_latitude,
location.lid AS lid,
location.longitude AS location_longitude,
location.latitude AS gmap_lat,
location.longitude AS gmap_lon
FROM location location
LEFT JOIN location_instance location_instance ON location.lid = location_instance.lid
LEFT JOIN node node ON location_instance.vid = node.vid
WHERE node.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid = 106305
  )

It joins the NODE table! Why on earth? We're not using nodes, its a term_location..

mrfelton’s picture

Status:Needs review» Needs work

This patch doesn't seem to do what I would expect.

My use case.

1) Assign lat/long to a taxonomy
2) Tag a node with that term
3) Create a view that uses the node table as the base, and shows pins on the map for each of the tagged locations.

mrfelton’s picture

It should expose the taxonomy lat/long fields to viwes like http://drupal.org/project/geotaxonomy does

YK85’s picture

My use case:

I use a Taxonomy Vocabulary where each Taxonomy Term is a station name

1) Assign lat/long to a taxonomy term
2) Tag a node with multiple terms
3) Create a view that shows all station names with a number of how many nodes are flagged with that term.

Is this possible?

thinkact’s picture

StatusFileSize
new4.88 KB
PASSED: [[SimpleTest]]: [MySQL] 425 pass(es).
[ View ]

I've tested the patch in #1 and it works perfect with Location-6.x-3.1! I've done a little tweak for PostgreSQL db. Will it be added to the module?

It is my use case:

  • Create a taxonomy for certain locations.
  • Set co-ordinates in the terms.
  • Tag the term on nodes
  • Create a view to filter the nodes with relationship (Taxonomy: Related terms) on this vocabulary.
  • Select the Location:Latitude and Location:Longitude as the fields with this relationship
  • Show the view style as "GMap" and select these two fields as the co-ordinates
  • The nodes shows on the map view according to the taxonomy terms!

This patch is so useful that the location can be simplified to only those taxonomy terms. Users need not worry about choosing the exact location. It is great improvement on user experience. Other use case would be probable, too!

rooby’s picture

Title:Views 2 should join location and term_data table when using location_taxonomy.module» Add views 2 support for the location_taxonomy module
Status:Needs work» Needs review
StatusFileSize
new5.59 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch location_taxonomy-views-429548-17.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Thanks for the patches, this is a much needed feature.

Looks pretty good to me. Using the patch in #16 I:
* fixed up some of the variables in the $output string to use curly syntax and quotes around string array keys.
* moved the functionality into the location_taxonomy module as that is where it should go.

For my testing it works for:
* taxonomy views with taxonomy location data
* node views where you have a relationship to the taxonomy terms with taxonomy location data
* location views with term data

It would be good to get someone else to test to make sure there aren't any issues before committing but I think it looks pretty good.

nclavaud’s picture

subscribing

nclavaud’s picture

Using #17 I could successfully build a map of taxonomy terms (containing location data), each term showing a list of related nodes. No errors to be reported. Great!

Agileware’s picture

I am using the patch in #17 with the latest dev of location and gmap 1.1 for a taxonomy term view and it is working correctly.

Agileware’s picture

I also have a taxonomy term view that is displaying the locations of nodes that have the given terms using a relationship.

To get the right locations on the map (the node ones not the term ones) I added the Location: latitude and Location: longitude fields to the view using my node relationship (the base table of my view is taxonomy term), excluded them from display and selected them for the data source option in the gmap style settings.

Using that technique you could also do the opposite - show term locations on a node view.

thinkingcap’s picture

subscribing

rooby’s picture

Version:6.x-3.x-dev» 7.x-3.x-dev
Status:Needs review» Patch (to be ported)

Committed to 6.x-3.x-dev.
http://drupalcode.org/project/location.git/commit/2789c19

Still needs porting to 7...

deanflory’s picture

Would anyone be able to provide a noob with instructions on how to do this in Views? I've tried but can't seem to pull the address and a map out of the term. If it can only pull longitude/latitude coordinates, then it really doesn't fulfill my needs I guess. Any help would be appreciated.

I'd like to have a View that can work in a content type template that pulls the term ID from one particular vocabulary, then presents the location map and in another pane the address. Anyone help?

makeapage’s picture

We all would benefit greatly if this is ported to the drupal 7 version.
subscribe

sensifreak’s picture

Any plans for views 3 and Drupal 7?

fehin’s picture

I'm bring this up for D7 port.

podarok’s picture

Status:Patch (to be ported)» Needs review

bot

Status:Needs review» Needs work

The last submitted patch, location_taxonomy-views-429548-17.patch, failed testing.

bmcmurray’s picture

Title:Add views 2 support for the location_taxonomy module» Add taxonomy term Views support for the location module
Status:Needs work» Needs review
StatusFileSize
new1.21 KB
PASSED: [[SimpleTest]]: [MySQL] 425 pass(es).
[ View ]

Attached is a patch to add Views 3 integration for taxonomy_term_data (taxonomy terms) and Location to work together.

podarok’s picture

Status:Needs review» Fixed

#30 commited pushed to 7.x-3.x
will be tagged in upcoming release
thanks!!!

Status:Fixed» Closed (fixed)
Issue tags:-location, -location taxonomy

Automatically closed -- issue fixed for 2 weeks with no activity.