Even though geofield is a standard way to handle geo-data in drupal, there might be cases where using a text field (storing lat/long or WKT) might be the only option, for example, the indexed values of geofield data that are available in my Search API view.
What would be the right way for this to be implemented and contributed? I was thinking about adding more options to the current style plugin or maybe extending it into a new plugin.
I will give it a go in the next weeks, so any comments would be appreciated.
By the way, learning about leaflet I saw this issue: #1829580: Support Search API and others!. Reading it I got the impression you can make Search API views and leaflet work toghether, but I have no real geofield available, just the indexed node values. Am I missing something?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | add_wkt_support-1926568-3.patch | 2.23 KB | Roensby |
Comments
Comment #1
esclapes commentedI found out that Search API provides the indexed node fields, and the geofield is among them.
I was using the index-stored value in my OpenLayers and that got me started with the wrong foot.
I leave the issue open for the maintainers to decide if it is a valid use-case.
Comment #2
dasjomy preferred setup is views_geojson + optionally leaflet_geojson to pull in the map data using an ajax request. views_geojson supports separate text fields for latitude / longitude
Comment #3
Roensby commentedThe views_geojson + leaflet_geojson route is overkill in my opinion.
edit: to expand, in order to get leaflet to consume anything other than a geofield, you have to install views_geojson, leaflet_geojson and the beans module. The process is then as follows:
1) expose your data through a view with a geojson display.
2) create a leaflet_geojson bean and configure the bean to consume the geojson view
3) display bean as a normal block.
I've included a patch to add wkt support to leaflet views.
To enable wkt support, the patch creates a geofield array by calling geofield_compute_values() and passes that on to leaflet_process_geofield() for further processing like any other geofield.
Or should this have been done as a plugin instead?