I need coordinates for each term in a cities taxonomy I got one a site for one of my clients. I found Geofield, which I use on nodes on that very same site, and it works as it should. However in my city taxonomy Geofield has a bug that makes it unable to get coordinates based on a title, which the term name is.

So I figured that I might copy the value of the title into another field for a term - like Title Copy field, and then base Geofield coordinates by that. Now, I don't know how..

I've found Computed Field which I find to complex for this, Tokens I don't get to work, Reference auto fill needs yet another source field so it goes away.

Any ideas for a simple solution that will work with terms created from both the taxonomy UI AND when nodes add new terms from a Autocomplete field?


2 Answers 2


I am assuming you have a content type with a field "Title" of type "Term Reference"... and you want to pass an address from this existing field to a hidden field for Geo coding or whatever else for that specific page.

I would suggest using views and entity reference to do this. This method is useful for passing multiple fields, but can be used to grab just one...

Once you have the Entity Reference module enabled and installed create a view. For the view's display options (that + sign) add 'Entity Reference'.

Add a field to this view of type: "Content: All taxonomy terms"

In the next options screen you can limit the options here to your specific 'Cities' vocabulary.

You now need to add a contextual filter 'Content:NID' to get this view to only display the city term reference for the page that it's on.

Now go back to your content type and add a field of type 'Entity Reference'. Configure it like this:

  • Target Type - Node

  • Mode - Views (filter by an entity reference view)

  • View used to select the entities - 'my entity reference view'

Now add your Geofield and configure it to 'Geocode from another field' - i.e. your entity reference field (which you can hide in the display options)

In the event that a city name alone is insufficient to geocode from consider adding other fields to your content type and passing them to your entity reference view.

  • Unfortunately this won't work. The coordinates has to be stored with the taxonomy term, not a node. But thanks a lot. Jun 18, 2014 at 12:28

What I did was to use Rules.

  1. Create a text field to be used for the copied value from name/title of the term (aka "copy field" for now).
  2. Create a geofield that bases the coordinates from the copy field.
  3. Create a rule that will be run before a taxonomy term is saved.
  4. Set an action that copies the value of name/title field to your copy field.
  5. Create a action to run some PHP code and add: taxonomy_term_save($term);
  6. Save the rule.
  7. Save a taxonomy and it will copy the name/title to the copy field and get the coordinates from that field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.