PHP Classes

File: readme_PlusCodeLocal.txt

Recommend this page to a friend!
  Classes of Ray Paseur  >  PHP PlusCode Local  >  readme_PlusCodeLocal.txt  >  Download  
File: readme_PlusCodeLocal.txt
Role: Documentation
Content type: text/plain
Description: readme text file
Class: PHP PlusCode Local
Get the location information from PlusCode
Author: By
Last change:
Date: 2 years ago
Size: 1,794 bytes


Class file image Download
Class PlusCodeLocal

This static class extends the static class PlusCode, found here:

The class provides a single method, get() which takes as input a 
full Open Location Code and returns a string with a localized code.

The philosophy of the Google PlusCode address is that it "looks like 
a regular address, but with a short code where the street name and 
number would be."  This class tries to provide the "regular address"
part in a manner that looks similar to the PlusCode that Google might
produce.  It gives names of the nearby locations such that a full 
Open Location Code of "48Q39JW9+G9" would be returned in the form of
a local code like "9JW9+G9 Buenos Aires Argentina."  

This class has a dependency on web services from  To 
use the web services, you _must_ get your own API key from GeoNames.
Register and login to GeoNames here:

When you have your API key, insert it into the public static $apikey 
variable at the top of this class file.

The GeoNames API fails sometimes.  When this happens the Class
returns the original input Open Location Code.  The full OLC may
still be usable in many applications.  A PHP Notice will be issued 
saying something like this:
    "ERROR: canceling statement due to statement timeout"

The demonstration script for this class will call the GeoNames API 
repeatedly and in practice that might not be a good idea.  You may
want to consider downloading and hosting your own version of their

Documentation References:
For more information send a message to info at phpclasses dot org.