Download & Extend

Add views 2 support for the location_taxonomy module

Project:Location
Version:7.x-3.x-dev
Component:Location_views
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:location, location taxonomy

Issue Summary

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

AttachmentSizeStatusTest resultOperations
location_taxonomy-views.patch3.95 KBIdleFAILED: [[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 details | Re-test

Comments

#1

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

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.

AttachmentSizeStatusTest resultOperations
location_taxonomy-views.patch4.27 KBIdleFAILED: [[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 details | Re-test

#2

tagging. :)

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

#3

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

#4

Subscribing, looking forward to this!
greetings, Martijn

#5

subscribing

#6

subscribing

#7

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.

#8

subscribing.

#9

The patch is in comment #1.

#10

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

#11

Subscribing, greetings, Martijn

#12

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..

#13

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.

#14

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

#15

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?

#16

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!

AttachmentSizeStatusTest resultOperations
location_taxonomy-views-6.x-3.1.patch4.88 KBIdlePASSED: [[SimpleTest]]: [MySQL] 425 pass(es).View details | Re-test

#17

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

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.

AttachmentSizeStatusTest resultOperations
location_taxonomy-views-429548-17.patch5.59 KBIdleFAILED: [[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 details | Re-test

#18

subscribing

#19

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!

#20

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.

#21

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.

#22

subscribing

#23

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...

#24

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?

#25

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

#26

Any plans for views 3 and Drupal 7?

#27

I'm bring this up for D7 port.

#28

Status:patch (to be ported)» needs review

bot

#29

Status:needs review» needs work

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