Views 3.x, D7 entities and Field API brought different usage of views field aliases. The result is that features from views vector layer never get rendered to map.

CommentFileSizeAuthor
#1 1048178_openlayers_views_d7.patch16.18 KBmhrabovcin

Comments

mhrabovcin’s picture

StatusFileSize
new16.18 KB

This is just first version of patch, it has some hard-coded parts i.e. expecting Field API value to be stored under 'value' key, which works for Float field, might cause problems for other types of fields.

zzolo’s picture

@mathiaz.sk. Thanks for the patch! A few things to note.

1) This does allow me to use float fields as other_latlon values in a Views data overlay.
2) There are some unnecessary formatting changes which makes reading the patch a bit hard (minor thing).
3) And finally, the end structure of the $features array seems a bit off. The following from a view that utilizes floats for lat and lon fields and title and body for popup data. There is only one feature in the array. One big thing is that the 'features' data is embeded in each feature.

array (
  0 => 
  array (
    'attributes' => 
    array (
      'entity_id' => 'slkdfj slfj lskfj slkdfj slkfj dsf',
      'entity_id_rendered' => '<div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>slkdfj slfj lskfj slkdfj slkfj dsf</p>
</div></div></div>',
      'entity_id_1' => '41.89',
      'entity_id_1_rendered' => '41.89',
      'entity_id_2' => '-87.62',
      'entity_id_2_rendered' => '-87.62',
      'node_title' => 'A story',
      'node_title_rendered' => '<a href="/openlayers-7/node/1">A story</a>',
      'projection' => '4326',
      'wkt' => 'POINT(-87.62 41.89)',
    ),
    'wkt' => 'POINT(-87.62 41.89)',
    'projection' => '4326',
    'features' => 
    array (
      0 => 
      array (
        'entity_id' => 'slkdfj slfj lskfj slkdfj slkfj dsf',
        'entity_id_rendered' => '<div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even"><p>slkdfj slfj lskfj slkdfj slkfj dsf</p>
</div></div></div>',
        'entity_id_1' => '41.89',
        'entity_id_1_rendered' => '41.89',
        'entity_id_2' => '-87.62',
        'entity_id_2_rendered' => '-87.62',
        'node_title' => 'A story',
        'node_title_rendered' => '<a href="/openlayers-7/node/1">A story</a>',
        'projection' => '4326',
        'wkt' => 'POINT(-87.62 41.89)',
      ),
    ),
  ),
)
zzolo’s picture

Hey, similar work is being done here as well: http://drupal.org/node/1006652

mhrabovcin’s picture

Status: Needs work » Closed (duplicate)

Yes we're targeting same problem so probably would be better to close this issue and I'll try to collaborate on the longer threat. Also this patch has been wrongly targeting another issue with popup behavior which hasn't upgraded javascript. I'll make a new issue and post a patch.

Martin

MichaelP’s picture

Posting to a closed, duplicate thread, but anyway:

@mathiaz.sk: I'm observing popup behavior issues, and I see you address this somewhat here. Did you manage to post the issue as of #4?

Thanks.

mhrabovcin’s picture

@MichaelP I'll open new issue and post a patch there. Will do it today, thanks for reminder.

MichaelP’s picture

@matiaz.sk, already started: #1085106: Popup Behaviour !!