Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#1 | geofield_token_support_1720360_1.patch | 4.19 KB | mollux |
Comments
Comment #1
mollux CreditAttribution: mollux commentedComment #2
Brandonian CreditAttribution: Brandonian commented@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.
Comment #3
richardbporter CreditAttribution: richardbporter commentedI 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.
Comment #4
richardbporter CreditAttribution: richardbporter commented