This page provides GeoPo specifications and implementation guidelines for developers planning to build services or integrate GeoPo functionality.
1. About GeoPo
GeoPo is both a geolocation compression technology and the collective name for its associated web services.
The above URL is called a GeoPo URL, and the red characters "Z4RHXX" following "http://v1.geopo.creco.net/" constitute the GeoPo code.
2. GeoPo Code
GeoPo Code Structure
GeoPo codes consist of 1-10 character strings using a 64-character set that includes digits (0-9), lowercase letters (a-z), uppercase letters (A-Z), and two symbols (hyphen '-' and underscore '_'). These characters are all URL-safe (Reference: RFC1738).
Please note that GeoPo codes are case-sensitive. Exercise caution when using them with case-insensitive applications (though Windows servers can often be configured to handle case sensitivity).
The precision level of a GeoPo code is determined by its length. Longer codes provide higher precision (smaller scale denominators).
Encode
We use EQUIRECTANGULAR PROJECTION to explain following.
The equirectangular projection is a map projection that are mapped the Earth to cylinder. Handling of lat/lng is easy, but the distance and the area is not collect.
A following figure is a map that projected equirectangular and layered 8 divided grids. The vertical line is latitude(north latitude is plus value, south latitude is minus value), and the horizontal line is longitude(east longitude is plus value, west longitude is minus value.)
Encoding is to name a area that enclosed by grids a character.
A outline character is a code. The code is allocated from origin(south latitude of 90 degrees and west longitude of 180 degrees) north-south and west-east order.
So, 1st character of GeoPo is decided a code to contain range of area.
Encoding after the 2nd character
Nth character is encoded same method.
Avobe figure is represented that RX GeoPo code become fine map.
First select the area(R) from 64 divided mesh of the earth.
Second select the area(X) from 64 divided mesh of that area(R).
In this way, we can get more detailed geolocation as the GeoPo code is divided many times and length is bigger.
Pattern of encoding
Until now, we explain method of encoding. We explain specification of GeoPo to impliment.
This figure shows encoding pattern and 64 divided area that has a decimal number(outline) and a octal number(black color).
Latitude is the single digit in a octal and longitude is the double digit in a octal. On the other hand, lat/lng is a number from 0 to 63 in a decimal.
Encoding pattern order is '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-' and '_'. The order is numbers, big letters, small letters, hyphen and underscore.
For example, table shows lat/lng, a octal, a decimal and a encoding code of GeoPo.
Latitude order | Longitude order | A octal | A decimal | Code of GeoPo |
---|---|---|---|---|
0 | 0 | 00 | 0 | 0 |
1 | 0 | 01 | 1 | 1 |
0 | 1 | 010 | 8 | 8 |
2 | 1 | 012 | 10 | a |
4 | 4 | 044 | 36 | A |
6 | 7 | 076 | 62 | - |
7 | 7 | 077 | 63 | _ |
Implementation of GeoPo encoding
Implementation of GeoPo encoding algorism is more exist (ex. to octal and bit operation). Following introduction is easy to understand algorism. Various languages sample code in an appendix.
Lat/Long of converting are Degree measures. If you use Degree-Minute(DM) or Degree-Minute-Second(DMS), you should convert to degree measures.
North latitude and west longitude are minus value.
First, change a degree measure to a decimal number.
Lat/long plus 90 and 180 to make positive value. Then, divide by 90 and 180 to make 0-1 value.
At last, multiply 8 to the 10 power.
Next, determine which area the decimal-converted latitude and longitude correspond to in the GeoPo encoding.
For latitude: divide by 8 raised to the power of (9 - scale), then take the remainder when divided by 8. For longitude: perform the same calculation, take the remainder when divided by 8, then multiply by 8. Adding these two values produces a number from 0 to 63, which corresponds to the appropriate GeoPo character.
Repeat this routine for subsequent characters, noting that the power of 8 (9 - scale) changes with each iteration. The number of repetitions determines the GeoPo code's precision level (Scale).
Decode
The decoding method can be implemented by performing the reverse of the encoding process (GeoPo codes have reversibility).
However, since GeoPo supports small scales, the smaller the scale becomes, the larger the error from the encoded location information becomes. To average this error as much as possible, the formula includes conversion of latitude and longitude to the representative latitude and longitude of the area (the center coordinates of the area).
If you want to decode GeoPo on the client side to extract latitude and longitude independently, you need to extract the GeoPo code from the GeoPo URL.
You can extract the GeoPo code using the following regular expression:
http:\/\/geopo\.at\/([\w-_]{1,10})
3. About license
GeoPo URL and GeoPo code is free for using. You can use commercial and non-commercial.
When you use large scale, we need to consider scalability of server. Please contact me.
And, please contact me when you implement GeoPo to a application. I introduce your application (exclude closed site or illegal use).
Appendix. Sample code
Sample code
Sample code page is above link。