Is it possible to search for a city or an address?

Support MB Geolocation Is it possible to search for a city or an address?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30875
    Andreas WunderseeAndreas Wundersee
    Participant

    Hi,

    at first I needed the geolocation for complete addresses - that worked perfectly. But now I need the possibility to search for cities and addresses, because not every entry has a complete address.

    I thought that I just have to add the "types" field to the "geo"-entry, but the combination doesn't work. I can only search for "cities" or an "address" - is that right or is my code wrong?

        $meta_boxes[] = array(
            'id'      => 'geolocation',
            'title'   => 'GeoLocation',
            'context' => 'normal',
            'priority'    => 'high',
        'geo' => array(
                'componentRestrictions' => array(
                    'country' => 'deu'
                ),
                'api_key' => 'AIzaSyC6A39MylwOhGD7sU-CKCV2JAdSyve_2zM',
                'types' => array('address', '(cities)'),
            ),
    
            'fields' => array(
                array(
                    'type' => 'text',
                    'name' => 'Addresse',
                    'id'    => 'address',
                ),  
                array(
                    'type' => 'text',
                    'name' => 'Breitengrad',
                    'id'    => 'lat',
                    'binding' => 'lat', 
            'address_field' => 'address',
                ),
                array(
                    'type' => 'text',
                    'name' => 'Längengrad',
                    'id'    => 'lng',
                    'binding' => 'lng',
            'address_field' => 'address',
                ),      
            )
        );

    Thanks for your help,
    Andi

    #32078
    A RollinA Rollin
    Participant

    Any Answer to this?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.