I'm not sure if this is an OpenLayers issue or a Geofield issue.

I've created a content type that has a title, a body and a geofield (post_location). The geofield data is being properly captured and can be displayed on the node itself in WKT. I've created a view with an OpenLayers Data Overlay display. In the settings for the OpenLayers Data Overlay format I've set the Map Data Sources field to WKT, but then I try to set the WKT Field to my post_location field, it isn't listed - only the node title is listed. I've attached a screenshot.

Using OpenLayers 7.x-2.x-dev and Geofield 7.x-1.x-dev, as of today, May 3.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zzolo’s picture

Category: bug » support

Hey @add1sun. Sorry for the delay. Not sure if you did this yet, but you have to add your Geofield to the list of fields in Views. Make sure you format it as WKT (which is the default). Then you'll have that as a choice for the data source. Basically the Data Overlay settings just pull what fields have been add to the view.

Hope that helps.

add1sun’s picture

Aha! OK, that got my Geofield as the WKT Field, but the view is getting NULL for the value, even though I know there is a value since it displays on the node itself.

On the node view with formatter set to WKT I see:
Post location: POINT (12.52196211 55.6606232146)

In the view preview:

array (
  0 => 
  array (
    'projection' => '4326',
    'attributes' => 
    array (
      'title_rendered' => '<a href="/openlayers/node/1">Where am I?</a>',
      'title' => 'Where am I?',
      'field_post_location_rendered' => '',
      'field_post_location' => NULL,
      'name' => '<a href="/openlayers/node/1">Where am I?</a>',
    ),
    'wkt' => '',
  ),
)
zzolo’s picture

Hmmm. That's odd. Maybe you need the Geofield dev version?

zzolo’s picture

Component: OpenLayers Views » OL API
Status: Active » Closed (cannot reproduce)

Hi @add1sun. Did you figure this out? Re-open if needed.

cospace’s picture

FileSize
204.51 KB

Hi, @zzolo I have similar issue here bugging me a few days, I read through all the posts and videos and couldnt find any clue, can you help me out?

Drupal and openlayer, geofield version I use are all 7+versions.

What I did was:
1. add content field, field type ->geofield, widget type ->openlayers map (coz I wanna users can mark their location when creating content)
2. Create views and add openlayers data overlay, at the data source part, there are only three options which is lat/log value, WKT, boundary box ==> how can I select the geofield I just created? even I put WKT in step 1, the data source options dont have WKT field showing.

Attached a few screenshots to check.

million thanks.

cospace’s picture

I found this is due to didnt add location field in the views, thanks.