Have set up the following:

  • Content type with address field and geofield
  • Geofield widget is set to OpenLayers Map
  • Geocoder settings are set to 'Enable geocoding of location data' from address field
  • Everything configured as outlined by GreenSkunk in #1824708: How-to usecase? Add optional geocoding to map input widget so that only a single point can be marked and moved on the map.

Steps:

  1. Create node
  2. Add an address
  3. Map shows a single 'draw feature' button (see attached image) and only allows you to place a single point and move it (desired behaviour)
  4. Click 'Find using Address field'
  5. An extra 'draw feature' button is now visible and the map now allows multiple markers to be placed.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guictx’s picture

Same here with lateste 7.x-2.x-dev.

ufku’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev

This is because geofield settings are added twice by openlayers_geofield_widget_afterbuild() during ajax request.

In geofield.widgets.openlayers.inc(line 289) replace

  drupal_add_js(
    array(
      'geofield' => array(
        'widget_settings' => $element['#widget_settings'],
      ),
    ),
    'setting'
  );

with

  $element['#attached']['js'][] = array(
    'data' => array(
      'geofield' => array(
        'widget_settings' => $element['#widget_settings'],
      )
    ),
    'type' => 'setting',
  );

Sorry i can't provide a patch right now.

Enric Climent’s picture

Same bug.
I try #2 but doesn't works. any suggestion?
Thanks

antonello.dipinto’s picture

Issue summary: View changes

#2 works form me
thanks

mtoscano’s picture

Status: Active » Reviewed & tested by the community

A years old small issue still applying to latest version, #2 works.

poker10’s picture

Status: Reviewed & tested by the community » Active

Thanks for working on this. We cannot mark this RTBC when there is no patch.