[postgis-users] Understanding of Geohash of a line feature
Regina Obe
lr at pcorp.us
Tue Nov 22 12:28:31 PST 2022
David,
Sorry for the delay. For points ST_GeoHash is an exact location.
For everything else it’s really the hash of the bounding box. Since bound box covers more area, the length of the hash is shorter.
Here is an example to demonstrate:
SELECT ST_GeoHash(ST_GeomFromText('POINT(-20.234 50.897)', 4326));
Returns g919e9d098kp4n6m82ys
SELECT ST_GeoHash(ST_GeomFromText('LINESTRING(-20.234 50.897, -20.235 50.908)', 4326));
Returns: g919e
Note how the hash of the second is a subset of the first? So that means any geometry that starts with g919e essentially falls in the bounding box that the linestring forms.
Also note that the above answer is equivalent to:
SELECT ST_GeoHash(ST_GeomFromText('LINESTRING(-20.234 50.897, -20.235 50.908)', 4326)::box2d);
Hope that clarifies things,
Regina
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Shaozhong SHI
Sent: Monday, November 14, 2022 3:46 AM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: [postgis-users] Understanding of Geohash of a line feature
Any detailed explanation on Gehash of a line feature?
The following works and returns output.
ST_geoHash(ST_transform(a_line_geometry,4326))
However, what exactly the output means?
Anyone knows what the output means?
Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20221122/d0d318f2/attachment.htm>
More information about the postgis-users
mailing list