Geocoding: Entertaining results

02.2015 / Category: / Tags:

Recently I was working on a project which had a need for geocoding. Normally we use PostGIS along with some free data for geocoding. However, to cross check data and to verify results I decided to write a little Python function to see what Google would actually give me.

To come up with the Python function the first thing to do is to install geopy, a module freely available on the web:

The stuff can be compiled and deployed easily:

Then PL/Python has to be enabled:

Then the function can already be written. The first thing I have done here is to come up with a data type returned by the function. In the example the position, the longitude and the latitude are relevant:

Finally there is the function itself, which connects to Google and fetches some data. It is more or less trivial:

Now we can test the function with some sane input:

The result gives us the position of our Cybertec headquarter here in Austria. So far so good ...

Unexpected results …

To see if my function works properly I tried to come up with a string, which seemed pretty unlikely to me:

Well, obviously some places are not blessed with proper names. There seem to be dirt holes in Australia after all 😉

Let us focus our attention on some more “religious” question:

It seems that even this leads to a result ...

But, this is pointless.

… or maybe just insane ...

Maybe we should not trust everything returned by a webservice

We have some more great GIS posts for your right here on our GIS blog spot... enjoy!

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
CYBERTEC Logo white
CYBERTEC PostgreSQL International GmbH
Römerstraße 19
2752 Wöllersdorf

+43 (0) 2622 93022-0

Get the newest PostgreSQL Info & Tools

    This site is protected by reCAPTCHA and the Google Privacy Policy & Terms of Service apply.

    CYBERTEC PostgreSQL International GmbH
    Would love your thoughts, please comment.x
    linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram