[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] Understanding of Geohash of a line feature
From:       Shaozhong SHI <shishaozhong () gmail ! com>
Date:       2022-12-15 0:43:31
Message-ID: CA+i5JwbMk-aE6=ODtdDa47nLAKxxff1SkF+FWtMXLKY7qy7rhQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/related)]

[Attachment #4 (multipart/alternative)]


Hi, Regina,
I need to be confident with a method to use a polygon to filter out all
line or point features in and around the polygon so that I have a smaller
data set to work on.
Is this approach robust?
Regards,
David

On Wednesday, 14 December 2022, Regina Obe <lr@pcorp.us> wrote:

> 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@lists.osgeo.org] *On
> Behalf Of *Shaozhong SHI
> *Sent:* Wednesday, December 14, 2022 1:03 PM
> *To:* PostGIS Users Discussion <postgis-users@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,
>
>
>
> [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@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@lists.osgeo.org] *On
> Behalf Of *Shaozhong SHI
> *Sent:* Monday, November 14, 2022 3:46 AM
> *To:* PostGIS Users Discussion <postgis-users@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@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
>

[Attachment #7 (text/html)]

Hi, Regina,<div>I need to be confident with a method to use a polygon to filter out \
all line or point features in and around the polygon so that I have a smaller data \
set to work on.</div><div>Is this approach \
robust?</div><div>Regards,</div><div>David<br><br>On Wednesday, 14 December 2022, \
Regina Obe &lt;<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>&gt; wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">The \
larger the polygon generally the larger the bounding box.   This of course is not \
always true.<u></u><u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">You \
could have a skinny large polygon that doesn't have much area but is a huge length \
angled.<u></u><u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">So \
the bounding box of that would be big even though the area might not be so \
big.<u></u><u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> \
<u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">At \
a certain point, you'll find that the geohash returns an empty string because you \
can't use it to filter out anything.<u></u><u></u></span></p><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> \
<u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> \
<u></u></span></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> \
<u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in \
0in 0in 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 \
1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> postgis-users \
[mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" \
target="_blank">postgis-users-bounces@<wbr>lists.osgeo.org</a>] <b>On Behalf Of \
</b>Shaozhong SHI<br><b>Sent:</b> Wednesday, December 14, 2022 1:03 PM<br><b>To:</b> \
PostGIS Users Discussion &lt;<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><wbr>&gt;<br><b>Subject:</b> Re: \
[postgis-users] Understanding of Geohash of a line \
feature<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u>  \
<u></u></p><div><div><p class="MsoNormal">Hi, Regina,<u></u><u></u></p></div><div><p \
class="MsoNormal"><u></u>  <u></u></p></div><div><p class="MsoNormal">The matter \
seems to be more complicated than that.<u></u><u></u></p></div><div><p \
class="MsoNormal"><u></u>  <u></u></p></div><div><p class="MsoNormal">I just tried \
the same method on a large polygon and found a table of geohash values at different \
granularity,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u>  \
<u></u></p></div><div><p class="MsoNormal"><img width="133" height="298" \
src="cid:image001.png@01D90FD0.0F1AD050" \
alt="image.png"><u></u><u></u></p></div><div><p class="MsoNormal"><u></u>  \
<u></u></p></div><div><p class="MsoNormal">Can one understand that the coverage of \
this polygon involves all these geohash grid?<u></u><u></u></p></div><div><p \
class="MsoNormal"><u></u>  <u></u></p></div><div><p class="MsoNormal">A clear \
understanding of what these mean is important.<u></u><u></u></p></div><div><p \
class="MsoNormal"><u></u>  <u></u></p></div><div><p \
class="MsoNormal">Regards,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u>  \
<u></u></p></div><div><p class="MsoNormal">David<u></u><u></u></p></div><p \
class="MsoNormal"><u></u>  <u></u></p><div><div><p class="MsoNormal">On Tue, 22 Nov \
2022 at 21:40, Regina Obe &lt;<a href="mailto:lr@pcorp.us" \
target="_blank">lr@pcorp.us</a>&gt; wrote:<u></u><u></u></p></div><blockquote \
style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in \
6.0pt;margin-left:4.8pt;margin-right:0in"><div><div><div><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">David,</span><u></u><u></u></p><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Sorry \
for the delay.   For points ST_GeoHash is an exact \
location.</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">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.</span><u></u><u></u></p><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Here \
is an example to demonstrate:</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">SELECT \
ST_GeoHash(ST_GeomFromText(&#39;<wbr>POINT(-20.234 50.897)&#39;, \
4326));</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Returns \
g919e9d098kp4n6m82ys</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">SELECT \
ST_GeoHash(ST_GeomFromText(&#39;<wbr>LINESTRING(-20.234 50.897, -20.235 50.908)&#39;, \
4326));</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Returns: \
g919e</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">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.</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Also \
note that the above answer is equivalent to:</span><u></u><u></u></p><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">SELECT \
ST_GeoHash(ST_GeomFromText(&#39;<wbr>LINESTRING(-20.234 50.897, -20.235 50.908)&#39;, \
4326)::box2d);</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Hope \
that clarifies things,</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Regina</span><u></u><u></u></p><p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">  \
</span><u></u><u></u></p><div style="border:none;border-left:solid blue \
1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid \
#e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> postgis-users \
[mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" \
target="_blank">postgis-users-bounces@<wbr>lists.osgeo.org</a>] <b>On Behalf Of \
</b>Shaozhong SHI<br><b>Sent:</b> Monday, November 14, 2022 3:46 AM<br><b>To:</b> \
PostGIS Users Discussion &lt;<a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><wbr>&gt;<br><b>Subject:</b> \
[postgis-users] Understanding of Geohash of a line \
feature</span><u></u><u></u></p></div></div><p class="MsoNormal">  \
<u></u><u></u></p><div><div><p class="MsoNormal">Any detailed explanation on Gehash \
of a line feature?<u></u><u></u></p><div><p class="MsoNormal">  \
<u></u><u></u></p></div><div><p class="MsoNormal">The following works and returns \
output.<u></u><u></u></p></div><div><p class="MsoNormal">  \
<u></u><u></u></p></div><div><p \
class="MsoNormal">ST_geoHash(ST_transform(a_<wbr>line_geometry,4326))<u></u><u></u></p></div><div><p \
class="MsoNormal">  <u></u><u></u></p></div><div><p class="MsoNormal">However, what \
exactly the output means?<u></u><u></u></p></div><div><p class="MsoNormal">  \
<u></u><u></u></p></div><div><p class="MsoNormal">Anyone knows what the output \
means?<u></u><u></u></p></div><div><p class="MsoNormal">  \
<u></u><u></u></p></div><div><p \
class="MsoNormal">Regards,<u></u><u></u></p></div><div><p class="MsoNormal">  \
<u></u><u></u></p></div><div><p \
class="MsoNormal">David<u></u><u></u></p></div></div></div></div></div></div><p \
class="MsoNormal">______________________________<wbr>_________________<br>postgis-users \
mailing list<br><a href="mailto:postgis-users@lists.osgeo.org" \
target="_blank">postgis-users@lists.osgeo.org</a><br><a \
href="https://lists.osgeo.org/mailman/listinfo/postgis-users" \
target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-users</a><u></u><u></u></p></div></blockquote></div></div></div></div></div></blockquote></div>



["image001.png" (image/png)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic