I wrote support for the token module, so all the geofield values can be accessed through tokens.
I needed this because I want to add token support to search_api_location, so you can do a location search based on a value in for example the profile of the current user.

You can see the result of the patch in following image: http://spatial.mollux.be/geofield_token.jpg

CommentFileSizeAuthor
#1 geofield_token_support_1720360_1.patch4.19 KBmollux
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mollux’s picture

Brandonian’s picture

Status: Active » Needs work

@mollux, looks interesting. One thing that I noticed is that the wkt output no longer works, because we've recently changed the field structure (See #1515402: Store wkt data as blobs/WKB by default). Also, we're likely to adopt some changes soon that will cause our field schema to become more fluid (See #1728530: Pluggable storage for Geofield for alternative databases).

This is definitely on my radar, though. It should be fairly straightforward to convert the wkt field to point to the geom field. Note that it's stored as WKB, which probably should be converted to WKT for output.

richardbporter’s picture

Issue summary: View changes

I have this use case as well. Is there currently a way to get lat/lon points through token? I'd be willing to contribute if not.

Edit:
It looks like it is possible with the entity_token module by using %node:field-geo:lat. However, the number seems to be rounded, e.g. -91.5301683 prints out as -91.53.

richardbporter’s picture