Combining Location module with Taxonomy
asb - May 20, 2008 - 17:29
| Project: | Location |
| Version: | 6.x-3.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | bdragon |
| Status: | reviewed & tested by the community |
| Issue tags: | location bdragon check, location taxonomy |
Jump to:
Description
Hi,
for several years, I'm maintaining some kind of locative information in a vocabulary (when I set up my site, either I wasn't aware of this fine module, or it din't exist yet); it's a simple hierarchy, starting with continents, broken down to geographical regions, countries, and districts.
Is there a way to
(a) somehow attach locative information from the "location" module to a term, or
(b) add locative information from the "location" module to nodes, based on the existing classification?
Maybe someone already did some work in this area?
Thanks for your thoughts & greetings, -asb

#1
Hi,
+2 for taxonomy/location integration!
greetings,
Martijn
#2
Started on it, you should be able to set up and save locations on terms.
http://drupal.org/cvs?commit=192486
There's no code to acutally *display* them, still pondering the best way to go about that. A block perhaps?
#3
Hi, If the locations are duplicated in say a location vocabulary, with the hierarchy countries, provinces, places, adresses like location has. There all other sorts of modules to display them, like taxonomy_menu.
great you are working on this!
greetings,
Martijn
#4
Actually..May I suggest that the address that is geocoded actually link to the taxonomy terms being created.
Or maybe the user can be given an option in the admin settings if they want the address to be lined directly to the taxonomy terms created by this module or just display the addres as it is.
Hope this makes sense
#5
Hi, I do not think that is the way to move forward. Location tables has its own centre in different modules.
Location has its own module set, and functionality and taxonomy has its own module set and functionality.
It would be absolutely great to have the location-hierarchy also been placed in a location-vocabulary. So an option when inserting, importing or via some module like feedapi importing locations, that than always also the location-vocabulary is being updated.
So location and taxonomy are then always in sinc.
Then the drupal moduleset as a whole can be used throughout the content. Nodes with location are then tagged with taxonomy and are able to be shown on maps and location-specific modules.
Greetings, Martijn
#6
Edit: Actually looked at the code & implementation. Changing my opinion.
I agree with Summit. I think the current implementation, while people might want this, is not the way we should be going about it. Perhaps both current implementation and the one Summit has proposed have their places though. I require the latter.
Current the implementation is to create your terms. Attach Locations to terms, then attach these terms to nodes.
What I would like to see, as I believe Summit is asking for, is that when you create a location on a node, that location information is mirrored into a Location Vocabulary.
Example. You create a node and attach a location of USA -> New York -> New York City , that would create the vocabulary terms attached the node in the same hierarchy using the human readable names as term_name.
This would open up the location data to other modules which deal with taxonomies like facetted search with taxonomy_facet
#7
Line 43 error. Need to pass by reference.
had to change
<?phplocation_save_locations(array(), array('genid' => 'taxonomy:'. $array['tid']));
?>
to
<?php$foo = array();
location_save_locations($foo, array('genid' => 'taxonomy:'. $array['tid']));
?>
Might be my fault as I'm using the stable DRUPAL-6--3-1-RC1 branch of location and then simply checkout this module from DRUPAL-6--3
#8
Hi, I do not understand what this code-change has to do with new code for location/taxonomy integration?
and may be you can join forces with bdragon to get great code for location/taxonomy integration?
Greetings, Martijn
#9
I am also interested in the ways taxonomy.module and location.module can work together. I've actually got my own way of approaching it that I'm not completely satisfied with either. I think the basic problem is that it's that we're wanting to add more information to a term, and there's no real great way to do this until Drupal 7.
I am using taxonomy.module with locations to manage a site's place name (toponym) vocabulary: names of countries, administrative divisions, cities, towns, landmarks, buildings. I leverage Geonames to retrieve latitude and longitude for places, but I can also input latitude and longitude by hand or by pointing to a spot on the map. The Geonames hierarchy of names isn't always important to me. It's simply a find the place I'm making a term for. I'm still choosing the name, parents, relations and synonyms for my term. I'm using these place terms to tag my content. Ultimately, I need to display a map of these terms as a block on the node.
All this is happening now in a module I've called placeterms, but I've not released because I didn't want to carelessly add to contrib module duplication and overlap. It's basically a slight variation on the method used for location_taxonomy, and I want to contribute a patch to improve this as soon as I've merged my code with it. It would be great if we could get Views 2 support for location_taxonomy, because then display can be handed off to Views 2 plugins, but right now I'm displaying a static Google map
Summit, j0rd and manuj_78 talk about synchronizing locations between nodes and terms in a vocabulary. This is an interesting problem, but it's probably outside the scope of location.module. Try looking at Node Auto Term module (NAT) which already synchronizes titles of nodes and terms in a vocabulary. Or Primary term module. These modules don't begin to solve the specific problem of synchronizing node locations and term locations, but I think they point to some other ideas.
#10
Hi,
I read al this of above post. Yes it's valuable but not for this discussion. Please file your module on contribute and start discussion about functionality there.
Isn't this request essential about to get locations into a location vocabulary? Something along the line of http://drupal.org/project/hierarchy and than automatically filled when a record is added to the location table.
My and I think others requirement is that when locations are filled (country, province, city, street), it would be great to have them mirrored to a location vocabulary which has this same hierarchy. This way the location information can also be used on taxonomy purposes, taxonomy menu, tagclouds, you name it.
It would be best of both worlds, so Yes +1 for location-taxonomy integration!!
Greetings,
Martijn
#11
The only essential task to make taxonomy support locations is to add taxonomy fields (at a minimum latitude and longitude) to taxonomy terms.
I raised the points about my own module because it performs exactly the same tasks as what bdragon has done in location_taxonomy, but mine has additional features to grab information from the Geonames database. If I were obliged to use the hierarchy implied by the political and administrative structures of nations and cities, I would not be able to use this module.
Most users won't have permission to edit taxonomy terms without additional access control modules, so I think this is why people want to synchronize nodes and terms because it's easier to give people permissions to edit their own nodes. But how do you keep terms unique when multiple nodes all refer to "Paris" or "Beirut?" This sounds like the wrong way to address this problem.
#12
Hi, I disagree that the only essential task is to add at a minimum lat and lon to taxonomy terms. It is one of the things, not the only essential thing.
I think with enabling the location fields country, province, city in their own vocabulary controlled by location, would benefit a lot! Because then the whole taxonomy range of modules comes into location scope.
SO again +1 for location mirroring in taxonomy vocabulary!
Greetings,
Martijn
#13
This needs to be more throughly understood.
If I'm developing a site for an Irish audience, I may need to merge the Northern Ireland counties that are legally part of the United Kingdom with the other counties from the Republic of Ireland. However, if I need to use these counties in a location taxonomy, I will be reverting the 6 counties in the north to a different position in the taxonomy (under United Kingdom), possibly breaking Views that filter by children of the "Ireland" term.
If I'm developing a site about global cities, I simply do not care that New York is in New York (state), Toronto is in Ontario or Tokyo is in Kantō. I might need region/province/state data fields on my nodes because this improves usability for users who are familiar with entering complete postal addresses. Users may have to stop and think when they see that the data input goes from City to Country. Transmitting all that information to a taxonomy hierarchy harms usability if I want my site to be structured according to broad geographic regions. Asia -> Tokyo, North America -> Toronto.
Creating the hierarchy of place names according to the data in a location field is potentially harmful to a site's architecture, and it would make this module unusable for me and I expect others. Split this issue apart from this one, make it optional and configurable, because it's not essential to adding location data to taxonomy terms. Don't bundle geographic names with geocoding. They're two separate problems.
#14
Hi Benjamin,
Adding to your second example. If you where developing a site about global cities. You definitively want to show the hierarchy and of course google map about it.
So it would be great if from America-New York- New York hierarchy with taxonomy menu you could come to the new-york node and on that node through location have the google map also shown. The combined functionality is just as it should be. Now I have to do both separately. Build a location-hierarchical vocabulary and plot locations through location.
See for example www.trekking-world.com/Nepal and http://www.trekking-world.com/regional/nepal/kathmanduvalley/kathmandu . It would be great if the vocabulary would fill automatically by plotting locations or entering locations through location module. Now I had to enter them by myself, while the information is allready in the locations table.
I disagree though it is potentially harmful! It is a choice and has nothing to do with harmful. You could for instance only show the country and city level if you like. I think it is still annoying to have location information through location, and than manually have to add the same information into a vocabulary. It would be great if location module could automatically fill a location-vocabulary with hierarchy and YES off course you as architect of the site could choose to use it or not. It has nothing to do with harmful in my opinion.
Greetings, Martijn
#15
tagging.
marked #306996: Any way to utilise a Location field (e.g. 'country') as a taxonomy term? as a duplicate of this issue.
#16
marked #335754: Location-Taxonomy integration question as a duplicate of this issue. (it suggests a starting point in the place module)
#17
Subscribing. I've been wrestling with location vs taxonomy as well.
#18
marked #189726: Can I convert location Cities to taxonomy terms? as a duplicate
#19
subscribing. I've been wondering what to do about this too.
#20
I've been using location_taxonomy.module for over 1 month now, and it works very well. I think this issue can be closed and new bug reports or feature requests can be opened.
#21
I'm still with Summit on this one and I do not believe our concerns / features have been addressed with the current implementation. Please correct me if I'm wrong.
We're looking for duplicate location hierarchy in taxonomy, not attach locations to taxonomy terms.
#22
maybe the one part can be committed and a different issue can be opened for the other?
#23
subscribe for duplicate location hierarchy in taxonomy
#24
+1 on this location - taxonomy integration subject!
#25
subscribing
#26
I'm so glad this idea was proposed. I was starting to go a little crazy with displaying nodes based on Location using manually created pages with location URL's..
@bangpound: I see the Location options now appearing in Taxonomy when I am editing a new vocabulary. How are you using this new functionality?
I was looking at creating taxonomy terms for country, region and city - and using Location to locate each one of them. Then when a node is assigned a CCK Location (country, region, city and street), I can then take advantage of the mapping capabilities as well as the new location taxonomy structure.
I can see this method making my life a lot easier; especially when I can use taxonomy to list nodes rather than a complex view using the Location module and fiddly URL's.
#27
Andrewsuth:
I think this issue has become overloaded with chat. My comments at #9 and #13 are still accurate. I'll likely release the module I've made in a few weeks when my project is done.
#28
bangpound, please let us know when you release this module. It will be very useful.
#29
goron:
I'm not comfortable releasing the module until #429548: Views 2 should join location and term_data table when using location_taxonomy.module is reviewed and committed. Are you in a position to review it?
#30
pangbound:
unfortunately I'm not...
#31
subscribing
#33
subscribing also
#34
I am unclear.
does this patch allow me to add location information to any taxonomy term?
Then an application is to come up with a vocabulary like state and attach location information to each term like CA?
If so, will this be automatic or do I have to input the terms and location information ahead of time.
I am a little confused.
Thanks,
Chris
#35
subscribing
#36
subscribing
#37
Still wanting the combination of taxonomy and location the other way around, so that location fields filling: country, province, city etc.. are put in a vocabulary with hierarchy country-province-city..
Thanks a lot in advance for considering this still.
greetings, Martijn
#38
subscribing
#39
subscribe to this useful feature!