mcguffin / acf-openstreetmap-field

WordPress ACF Field for OpenStreetMap
https://wordpress.org/plugins/acf-openstreetmap-field/
GNU General Public License v3.0
107 stars 21 forks source link

Convertig from ACF Type 'google_map' to 'open_street_map' - probably missing parameters #57

Closed hinnerkweiler closed 3 years ago

hinnerkweiler commented 3 years ago

Hi, I am trying to change a programmatically added Fieldgroup from Google to your OSM Interface. All Documentation refers to manually doing so and I cant find any information on how to do it in PHP. We just need to store lat/lon values from the backend using a map: With each post the author can just klick on the map and the location is associated with the post. I already browesed the source and so far found the proper type to be open_street_map. But changing just that renders only a line Drag Maker to move but no map. I assume the field-array needs information where to get tiles and stuff than acf's google_map but I can't find the parameters. Here's what I currently have. – Any Idea what else is needed to just get the map showing in the backend?

register_field_group(array (
        'id' => 'acf_geo-tagging',
        'title' => 'Geo-Tagging',
        'fields' => array (
          array (
            'key' => 'field_##################',
            'label' => 'Position',
            'name' => 'position',
            'type' => 'open_street_map',        //was 'google_map'
            'center_lat' => 54,
            'center_lng' => 10,
            'zoom' => 6,
            'height' => '',
          ),
        ),
        'location' => array (
          array ( 
            array (
              'param' => 'post_type',
              'operator' => '==',
              'value' => 'post',
              'order_no' => 0,
              'group_no' => 0,
            ),
          ),
        ),
        'options' => array (
          'position' => 'normal',
          'layout' => 'no_box',
          'hide_on_screen' => array (
            ),
          ),
          'menu_order' => 1,
        ));

Thanks for our input and maybe this post will help others to making the switch.

mcguffin commented 3 years ago

Hi, Seems that Your OSM-Field lacks the return_format, max_markers, layers and allow_layers properties.
Here's a field definition (in JSON) that should work:

https://github.com/mcguffin/acf-openstreetmap-field/blob/5864e7893ae0b70b95b7344e1eca2ebbfa77e5cd/test/acf-json/group_acf_openstreetmap_field_no_layers.json#L5-L29