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

Regina Obe lr at pcorp.us
Wed Dec 14 12:23:46 PST 2022


The larger the polygon generally the larger the bounding box.  This of course is not always true.

You could have a skinny large polygon that doesn’t have much area but is a huge length angled.

So the bounding box of that would be big even though the area might not be so big.

 

At a certain point, you’ll find that the geohash returns an empty string because you can’t use it to filter out anything.

 

 

 

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Shaozhong SHI
Sent: Wednesday, December 14, 2022 1:03 PM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: Re: [postgis-users] Understanding of Geohash of a line feature

 

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,

 



 

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 <mailto: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 <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 <mailto: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 <mailto: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/3c79c4e9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7919 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20221214/3c79c4e9/attachment.png>


More information about the postgis-users mailing list