geohash(latitude;longitude;precision)
Returns a geohash symbol with a given precision based on the coordinates of a particular location. (Available as of version 10.16)
Syntax
geohash(latitude;longitude;precision)
Input
Argument | Type | Description |
---|---|---|
latitude |
decimal | Latitude coordinate of a particular location |
longitude |
decimal | Longitude coordinate of a particular location |
precision |
integer | A number between 1 and 12 that specifies the precision (i.e., number of
characters) of the resultant symbol If omitted, the default is 6. |
Return Value
Returns a text string of precision
characters corresponding to a hash of
the latitude
and longitude
coordinates of a particular
location.
Nearby locations typically have hashes similar up to a certain number of initial characters.
Example
The following example calculates the geohashes of a number of landmarks in New York City, Washington D.C., and Paris. Those that begin with longer matching contiguous strings are closer in proximity. Each geohash is generated with a precision of 12 characters.
<base table="default.lonely"/> <willbe name="tenten" value="geohash(40.753683; -73.972640;12)"/> <willbe name="un" value="geohash(40.7535628;-73.9724325;12)"/> <willbe name="chrysler" value="geohash(40.7517445;-73.9756722;12)"/> <willbe name="empirestate" value="geohash(40.7484445;-73.9878531;12)"/> <willbe name="worldtrade" value="geohash(40.7115282;-74.0145492;12)"/> <willbe name="whitehouse" value="geohash(38.8976805;-77.0387185;12)"/> <willbe name="eiffeltower" value="geohash(48.8583736;2.2922926;12)"/> <colord hide="c1"/>
Notice in the example that the locations in New York City share a greater number of leading characters, but they only have the first letter in common with the D.C. location. Furthermore, the New York locations share no leading characters with the one in Paris.