Hi I am quite a newbie trying to get a geocode from a taxonomy reference field via geocoder to openlayers,
the Idea is the following: Use taxonomy vocabulary country with terms countries and vocabulary city with terms cities.
Country terms is a list where the user can select the country, cities is a tagging field, both field will be in user profiles.
Now I need help to connect taxonomy vocabulary with the geocoder module.
Can some one help?

Thanks

CommentFileSizeAuthor
#4 taxonomy_title.patch1.11 KBmichaelfavia

Comments

hkosbab’s picture

Title: Geocode form a taxonomy_reference field » Geocode from a taxonomy_reference field
Assigned: hkosbab » Unassigned
keremito’s picture

Hi there,

Since I couldnt make the module accept taxonomy field yet, I've installed computed field module, and add the following code there;
$entity_field[0]['value'] = taxonomy_term_title(taxonomy_term_load($entity->field_yourfieldname['und'][0]['tid']));

This makes computed field get the taxonomy term, so you can use that on geocoder. Bad news is, when the node is first saved, computed field is there, but geofield is empty. If you update the node, geocode is also calculated. So you need the save them twice..

phayes’s picture

Assigned: Unassigned » phayes
Category: support » feature

This is a pretty interesting idea. I think we could likely implement it

michaelfavia’s picture

StatusFileSize
new1.11 KB

I hacked together a quick addition that lets you geocode from the taxonomy term name field. I assume you want to use a field attached to that entity like address or something?

Patch attached. Let me know if this is what you meant and if it works for you (does for me).

michaelfavia’s picture

Status: Active » Needs review

Mark for review

phayes’s picture

Status: Needs review » Fixed

Done! Thanks michaelfavia!

Status: Fixed » Closed (fixed)

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