8000 GoogleMaps admin levels get lost · Issue #483 · geocoder-php/Geocoder · GitHub
[go: up one dir, main page]

Skip to content
GoogleMaps admin levels get lost #483
Closed
@dereuromark

Description

@dereuromark

I used to standalone query the API and rely on the admin level / type info of google maps for knowledge of "accuracy".

When switching to the provider of this class this happens:

        [private] adminLevels => object(Geocoder\Model\AdminLevelCollection) {
                [private] adminLevels => [
                        (int) 1 => object(Geocoder\Model\AdminLevel) {
                                [private] level => (int) 1
                                [private] name => 'Berlin'
                                [private] code => 'Berlin'
                        }
                ]
        }

Only administrative_area_level_1 is left.
Especially sublocality_level_1/sublocality_level_2 data gets lost completely.

And more severally, the location_type => 'ROOFTOP' and types array info etc.

When I debug the result inside the GoogleMaps provider:

      (int) 0 => object(stdClass) {
                address_components => [
                        (int) 0 => object(stdClass) {
                                long_name => '87'
                                short_name => '87'
                                types => [
                                        (int) 0 => 'street_number'
                                ]
                        },
                        (int) 1 => object(stdClass) {
                                long_name => 'Oranienburger Straße'
                                short_name => 'Oranienburger Str.'
                                types => [
                                        (int) 0 => 'route'
                                ]
                        },
                        (int) 2 => object(stdClass) {
                                long_name => 'Mitte'
                                short_name => 'Mitte'
                                types => [
                                        (int) 0 => 'sublocality_level_2',
                                        (int) 1 => 'sublocality',
                                        (int) 2 => 'political'
                                ]
                        },
                        (int) 3 => object(stdClass) {
                                long_name => 'Mitte'
                                short_name => 'Mitte'
                                types => [
                                        (int) 0 => 'sublocality_level_1',
                                        (int) 1 => 'sublocality',
                                        (int) 2 => 'political'
                                ]
                        },
                        (int) 4 => object(stdClass) {
                                long_name => 'Berlin'
                                short_name => 'Berlin'
                                types => [
                                        (int) 0 => 'locality',
                                        (int) 1 => 'political'
                                ]
                        },
                        (int) 5 => object(stdClass) {
                                long_name => 'Berlin'
                                short_name => 'Berlin'
                                types => [
                                        (int) 0 => 'administrative_area_level_1',
                                        (int) 1 => 'political'
                                ]
                        },
                        (int) 6 => object(stdClass) {
                                long_name => 'Germany'
                                short_name => 'DE'
                                types => [
                                        (int) 0 => 'country',
                                        (int) 1 => 'political'
                                ]
                        },
                        (int) 7 => object(stdClass) {
                                long_name => '10178'
                                short_name => '10178'
                                types => [
                                        (int) 0 => 'postal_code'
                                ]
                        }
                ]
                location_type => 'ROOFTOP'
                types => [
                        (int) 0 => 'street_address'
                ]
                formatted_address => 'Oranienburger Str. 87, 10178 Berlin, Germany'

It seems the info is there, but gets lost during object hydration.

I realize that those info are highly provider specific. But those should at least be added to the levels here as well.
Or can the whole response be some custom array info available via $address->getCustom()/getDebug()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0