[postgis-users] Calculate the distance between a point and a line
Paul Ramsey
pramsey at cleverelephant.ca
Wed Jan 6 07:50:55 PST 2021
ST_Distance('SRID=4326;POINT(14.0007583 50.8379138)'::geography, way::geography) as dist
> On Jan 6, 2021, at 7:49 AM, Luca Bertoncello <lucabert at lucabert.de> wrote:
>
> Am 06.01.2021 16:45, schrieb Paul Ramsey:
>
>> Go ST_Distance(this::geography, that::geography) then.
>> DistanceSpheroid() I think still requires a spheroid definition which
>> makes it clunky
>
> Something like that:
>
> SELECT
> name,
> admin_level,
> ST_Distance(ST_Transform('SRID=4326;POINT(50.8379138888889 14.0007583333333)'::geography, 3857), way::geography) as dist
> FROM planet_osm_roads
> WHERE boundary = 'administrative'
> AND admin_level = '2'
> AND osm_id < 0
> ORDER BY admin_level DESC;
>
> ?
>
> I found the tip with cos() at https://postgis.net/docs/manual-3.1/ST_Distance.html
>
> Thanks
> Luca
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list