user860511
user860511

Reputation:

Geocoder returns USA results when GB is being specified

I am using a Laravel plugin to geocode a city into latitude and longitude.

This is what is sent:

$param = [ 'address' => $place, 'country:GB', 'types' => ["cities"] ];

Unfortunately, Google keeps returning all of the results from USA, not GB!

I have added the country and types into a components array, and it still returns USA results.

Any help would be hugely appreciated.

Upvotes: 0

Views: 55

Answers (1)

Jeff
Jeff

Reputation: 25221

you're sending the country wrong. in the docs:

To restrict your results to a specific area use component filter Component Filtering by adding it's filters to parameter array.

$param = array(
            "address"=>"76 Buckingham Palace Road London SW1W 9TQ",
            "components"=>"country:GB"
        );

Upvotes: 1

Related Questions