[postgis-users] Spatial linking or selection

Shaozhong SHI shishaozhong at gmail.com
Fri May 15 06:43:38 PDT 2020


Thanks.  Regina Obe.

I will test it.

Regards,

Shao

On Fri, 15 May 2020 at 13:44, Regina Obe <lr at pcorp.us> wrote:

> Please don’t count of autocasting of geometry -> geography.  This makes
> your code brittle as it may change in the future.
>
>
>
> You should explicitly cast your geometry to geography like
>
>
>
> ST_DWithin(a.geom::geography, b.geom::geography, somedistance)
>
>
>
> Or
>
>
>
> ST_DWithin(geography(a.geom), geography(b.geom), somedistance)
>
>
>
>
>
> Also keep in mind if you have spatial indexes on geometry – the above
> function can’t use them .  You’d need to add functional indexes for
> geography
>
>
>
> Something like
>
>
>
> CREATE INDEX ix_yourtable_geom_geog_gist USING gist(geography(geom));
>
>
>
> *From:* postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] *On
> Behalf Of *Shaozhong SHI
> *Sent:* Friday, May 15, 2020 8:35 AM
> *To:* PostGIS Users Discussion <postgis-users at lists.osgeo.org>
> *Subject:* Re: [postgis-users] Spatial linking or selection
>
>
>
> Hi, Friends,
>
>
>
> I am a little bit confused.
>
>
>
> If I use geometry as data type, do I put something like 5 metres and
> *use_spheroid*=false?
>
>
>
> Is that correct?
>
>
>
> Regards,
>
>
>
> Shao
>
>
>
> On Fri, 15 May 2020 at 13:00, Giuseppe Broccolo <g.broccolo.7 at gmail.com>
> wrote:
>
> Hi Shao,
>
>
>
> Il giorno ven 15 mag 2020 alle ore 11:56 Shaozhong SHI <
> shishaozhong at gmail.com> ha scritto:
>
> Hi, Nicolas,
>
>
>
> Thanks.
>
>
>
> That is very interesting.  I will test it.
>
>
>
> I could not find information on how distance is defined.  0.01 stands on
> what unit?
>
>
>
> https://postgis.net/docs/ST_DWithin.html
>
>
>
> Have a look to this statement in the doc you linked:
>
> """
> For geometry: The distance is specified in units defined by the spatial
> reference system of the geometries. For this function to make sense, the
> source geometries must both be of the same coordinate projection, having
> the same SRID.
>
>
>
> For geography units are in meters and measurement is defaulted to
> use_spheroid=true, for faster check, use_spheroid=false to measure along
> sphere.
>
> """
>
>
>
> Giuseppe.
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> 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/20200515/8a1688ae/attachment.html>


More information about the postgis-users mailing list