This patch provides an optional second argument to google_geocode_location which causes the function to return an array in this form...

Array
(
    [CountryNameCode] => GB
    [AdministrativeAreaName] => England
    [SubAdministrativeAreaName] => Greater London
    [LocalityName] => Barnet
    [coordinates] => -0.179890,51.562816,0
)

I personal am finding this useful as i'm importing data which contains a postcode and the address first line only. It provides a consistent list of towns and provinces.

Comments

yesct’s picture

Status: Needs review » Postponed

This sounds really cool. If someone wants to create a patch to implement this, please do. Since this has been inactive for over a year, I'll mark it postponed for now, because this might be an idea worth investigating in the future.

nickl’s picture

Status: Postponed » Needs review
StatusFileSize
new1.99 KB

Attached patch rolled against head.

When supplying the following details
Street address: 10 Springbok st
City: Pofadder
Country: South Africa
Traversing through the returned xml a data collection can be populated as follows.

Array\
(\
    [name] => 10 Springbok st, Pofadder\
    [code] => 200\
    [request] => geocode\
    [id] => p1\
    [address] => Springbok St, Pofadder 8890, South Africa\
    [Accuracy] => 6\
    [CountryNameCode] => ZA\
    [CountryName] => South Africa\
    [AdministrativeAreaName] => Northern Cape\
    [LocalityName] => Pofadder\
    [ThoroughfareName] => Springbok St\
    [north] => -29.1296450\
    [south] => -29.1359403\
    [east] => 19.3980672\
    [west] => 19.3914930\
    [coordinates] => 19.3948082,-29.1328123,0\
)\

Currently the location object is not being passed by reference and therefor the result cannot be populated back.
Any suggestions?

yesct’s picture

Issue tags: +location bdragon check

tagging

semiaddict’s picture

Hi,

Here's a different patch that adds a second boolean argument to google_geocode_location called full_result.
The argument is set to false by default, but if set to true returns the full geocoding result returned by google.

To make it easier to do this, I changed the format from xml to json. So the full result returned will be the result of a json_decode.

---
Oussama Mubarak // Semiaddict

podarok’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Issue tags: -location bdragon check

all feature requests should be rolled against latest 7.x-3.x-dev and after commit can be backported to 6.x branch

Status: Needs review » Needs work

The last submitted patch, location-allow-return-full-geocoding-result-213387-4.patch, failed testing.