[postgis-users] Understanding of Geohash of a line feature

Shaozhong SHI shishaozhong at gmail.com
Wed Dec 14 10:03:01 PST 2022


Hi, Regina,

The matter seems to be more complicated than that.

I just tried the same method on a large polygon and found a table of
geohash values at different granularity,

[image: image.png]

Can one understand that the coverage of this polygon involves all these
geohash grid?

A clear understanding of what these mean is important.

Regards,

David

On Tue, 22 Nov 2022 at 21:40, Regina Obe <lr at pcorp.us> wrote:

> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20221214/90460944/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7919 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20221214/90460944/attachment.png>


More information about the postgis-users mailing list