st_distance meter/degree

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

st_distance meter/degree

franco base
Hi all.
Is it possible that st_distance between point return meter distance if point are very close and degrees otherwise?

SELECT ST_distance ( ST_SetSRID (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))

return 1.3 ( meter distance)


SELECT ST_distance ( ST_SetSRID (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))

return 0.003 (degrees distance)


Thanks
fb




_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

Jorge Gustavo Rocha
Hi Franco,

You can use the usual control statements IF THEN ELSE [1] to make it
exactly like you want.

[1]
https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html

Regards,

Jorge

Às 10:57 de 13-04-2017, franco base escreveu:

> Hi all.
> Is it possible that st_distance between point return meter distance if
> point are very close and degrees otherwise?
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>
> return 1.3 ( meter distance)
>
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>
> return 0.003 (degrees distance)
>
>
> Thanks
> fb
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: +351 253604480
Fax: +351 253604471
Móvel: +351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

franco base
Thanks Jorge but it isn't the matter.
I'd know why postgis have a different way to calculate the distance
with the same sql query.

2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]>:
Hi Franco,

You can use the usual control statements IF THEN ELSE [1] to make it
exactly like you want.

[1]
https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html

Regards,

Jorge

Às 10:57 de 13-04-2017, franco base escreveu:
> Hi all.
> Is it possible that st_distance between point return meter distance if
> point are very close and degrees otherwise?
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>
> return 1.3 ( meter distance)
>
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>
> return 0.003 (degrees distance)
>
>
> Thanks
> fb
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: <a href="tel:%2B351%20253604480" value="+351253604480">+351 253604480
Fax: <a href="tel:%2B351%20253604471" value="+351253604471">+351 253604471
Móvel: <a href="tel:%2B351%20910333888" value="+351910333888">+351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

Olivier Leprêtre

Hi,

 

I don't understand why you see different units

First one does not return 1.33 but 1.33 10-5 so that is 0.0000133, the other is 0.0036239...

 

Olivier

 

De : postgis-users [mailto:[hidden email]] De la part de franco base
Envoyé : jeudi 13 avril 2017 12:54
À : PostGIS Users Discussion
Objet : Re: [postgis-users] st_distance meter/degree

 

Thanks Jorge but it isn't the matter.

I'd know why postgis have a different way to calculate the distance

with the same sql query.

 

2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]>:

Hi Franco,

You can use the usual control statements IF THEN ELSE [1] to make it
exactly like you want.

[1]
https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html

Regards,

Jorge


Às 10:57 de 13-04-2017, franco base escreveu:


> Hi all.
> Is it possible that st_distance between point return meter distance if
> point are very close and degrees otherwise?
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>
> return 1.3 ( meter distance)
>
>
> SELECT ST_distance ( ST_SetSRID
> (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
> (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>
> return 0.003 (degrees distance)
>
>
> Thanks
> fb
>
>
>
>
>

> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>


J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: <a href="tel:%2B351%20253604480">+351 253604480
Fax: <a href="tel:%2B351%20253604471">+351 253604471
Móvel: <a href="tel:%2B351%20910333888">+351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

 


Garanti sans virus. www.avast.com

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

Jorge Gustavo Rocha
In reply to this post by franco base
Hi Franco,

I did not understood your question.

Postgis calculates the distance/area according to the CRS unit. It the
CRS unit is degrees, the results is in degrees. If the CRS unit is
meter, the result is in meter.

For example, if you transform the geometry, like:
SELECT ST_Distance(ST_Transform(geometry, 25829)) ...
the result will be in meter.

Regards,

Jorge

Às 11:54 de 13-04-2017, franco base escreveu:

> Thanks Jorge but it isn't the matter.
> I'd know why postgis have a different way to calculate the distance
> with the same sql query.
>
> 2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi Franco,
>
>     You can use the usual control statements IF THEN ELSE [1] to make it
>     exactly like you want.
>
>     [1]
>     https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html
>     <https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html>
>
>     Regards,
>
>     Jorge
>
>     Às 10:57 de 13-04-2017, franco base escreveu:
>     > Hi all.
>     > Is it possible that st_distance between point return meter distance if
>     > point are very close and degrees otherwise?
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>     >
>     > return 1.3 ( meter distance)
>     >
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>     >
>     > return 0.003 (degrees distance)
>     >
>     >
>     > Thanks
>     > fb
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > postgis-users mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>     >
>
>     J. Gustavo
>     --
>     Jorge Gustavo Rocha
>     Departamento de Informática
>     Universidade do Minho
>     4710-057 Braga
>     Tel: +351 253604480 <tel:%2B351%20253604480>
>     Fax: +351 253604471 <tel:%2B351%20253604471>
>     Móvel: +351 910333888 <tel:%2B351%20910333888>
>     skype: nabocudnosor
>     _______________________________________________
>     postgis-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: +351 253604480
Fax: +351 253604471
Móvel: +351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

franco base
Sorry.
I don't see the 10-5at the end
very sorry

2017-04-13 13:05 GMT+02:00 Jorge Gustavo Rocha <[hidden email]>:
Hi Franco,

I did not understood your question.

Postgis calculates the distance/area according to the CRS unit. It the
CRS unit is degrees, the results is in degrees. If the CRS unit is
meter, the result is in meter.

For example, if you transform the geometry, like:
SELECT ST_Distance(ST_Transform(geometry, 25829)) ...
the result will be in meter.

Regards,

Jorge

Às 11:54 de 13-04-2017, franco base escreveu:
> Thanks Jorge but it isn't the matter.
> I'd know why postgis have a different way to calculate the distance
> with the same sql query.
>
> 2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi Franco,
>
>     You can use the usual control statements IF THEN ELSE [1] to make it
>     exactly like you want.
>
>     [1]
>     https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html
>     <https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html>
>
>     Regards,
>
>     Jorge
>
>     Às 10:57 de 13-04-2017, franco base escreveu:
>     > Hi all.
>     > Is it possible that st_distance between point return meter distance if
>     > point are very close and degrees otherwise?
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>     >
>     > return 1.3 ( meter distance)
>     >
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>     >
>     > return 0.003 (degrees distance)
>     >
>     >
>     > Thanks
>     > fb
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > postgis-users mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>     >
>
>     J. Gustavo
>     --
>     Jorge Gustavo Rocha
>     Departamento de Informática
>     Universidade do Minho
>     4710-057 Braga
>     Tel: <a href="tel:%2B351%20253604480" value="+351253604480">+351 253604480 <tel:%2B351%20253604480>
>     Fax: <a href="tel:%2B351%20253604471" value="+351253604471">+351 253604471 <tel:%2B351%20253604471>
>     Móvel: <a href="tel:%2B351%20910333888" value="+351910333888">+351 910333888 <tel:%2B351%20910333888>
>     skype: nabocudnosor
>     _______________________________________________
>     postgis-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>

J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: <a href="tel:%2B351%20253604480" value="+351253604480">+351 253604480
Fax: <a href="tel:%2B351%20253604471" value="+351253604471">+351 253604471
Móvel: <a href="tel:%2B351%20910333888" value="+351910333888">+351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

Olivier Leprêtre

 

De : postgis-users [mailto:[hidden email]] De la part de franco base
Envoyé : jeudi 13 avril 2017 13:08
À : PostGIS Users Discussion
Objet : Re: [postgis-users] st_distance meter/degree

 

Sorry.

I don't see the 10-5at the end

very sorry

 

2017-04-13 13:05 GMT+02:00 Jorge Gustavo Rocha <[hidden email]>:

Hi Franco,

I did not understood your question.

Postgis calculates the distance/area according to the CRS unit. It the
CRS unit is degrees, the results is in degrees. If the CRS unit is
meter, the result is in meter.

For example, if you transform the geometry, like:
SELECT ST_Distance(ST_Transform(geometry, 25829)) ...
the result will be in meter.

Regards,

Jorge

Às 11:54 de 13-04-2017, franco base escreveu:


> Thanks Jorge but it isn't the matter.
> I'd know why postgis have a different way to calculate the distance
> with the same sql query.
>
> 2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi Franco,
>
>     You can use the usual control statements IF THEN ELSE [1] to make it
>     exactly like you want.
>
>     [1]
>     https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html
>     <https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html>
>
>     Regards,
>
>     Jorge
>
>     Às 10:57 de 13-04-2017, franco base escreveu:
>     > Hi all.
>     > Is it possible that st_distance between point return meter distance if
>     > point are very close and degrees otherwise?
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>     >
>     > return 1.3 ( meter distance)
>     >
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>     >
>     > return 0.003 (degrees distance)
>     >
>     >
>     > Thanks
>     > fb
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > postgis-users mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>     >
>
>     J. Gustavo
>     --
>     Jorge Gustavo Rocha
>     Departamento de Informática
>     Universidade do Minho
>     4710-057 Braga
>     Tel: <a href="tel:%2B351%20253604480">+351 253604480 <<a href="tel:%2B351%20253604480">tel:%2B351%20253604480>
>     Fax: <a href="tel:%2B351%20253604471">+351 253604471 <<a href="tel:%2B351%20253604471">tel:%2B351%20253604471>
>     Móvel: <a href="tel:%2B351%20910333888">+351 910333888 <<a href="tel:%2B351%20910333888">tel:%2B351%20910333888>
>     skype: nabocudnosor
>     _______________________________________________
>     postgis-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>

>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>


J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: <a href="tel:%2B351%20253604480">+351 253604480
Fax: <a href="tel:%2B351%20253604471">+351 253604471
Móvel: <a href="tel:%2B351%20910333888">+351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

 


Garanti sans virus. www.avast.com

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st_distance meter/degree

franco base
Yes thanks a lot I understand.
I did't see it first to write the question to the list.
:(

2017-04-13 13:24 GMT+02:00 Olivier Leprêtre <[hidden email]>:

 

De : postgis-users [mailto:[hidden email]] De la part de franco base
Envoyé : jeudi 13 avril 2017 13:08
À : PostGIS Users Discussion
Objet : Re: [postgis-users] st_distance meter/degree

 

Sorry.

I don't see the 10-5at the end

very sorry

 

2017-04-13 13:05 GMT+02:00 Jorge Gustavo Rocha <[hidden email]>:

Hi Franco,

I did not understood your question.

Postgis calculates the distance/area according to the CRS unit. It the
CRS unit is degrees, the results is in degrees. If the CRS unit is
meter, the result is in meter.

For example, if you transform the geometry, like:
SELECT ST_Distance(ST_Transform(geometry, 25829)) ...
the result will be in meter.

Regards,

Jorge

Às 11:54 de 13-04-2017, franco base escreveu:


> Thanks Jorge but it isn't the matter.
> I'd know why postgis have a different way to calculate the distance
> with the same sql query.
>
> 2017-04-13 12:37 GMT+02:00 Jorge Gustavo Rocha <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi Franco,
>
>     You can use the usual control statements IF THEN ELSE [1] to make it
>     exactly like you want.
>
>     [1]
>     https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html
>     <https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html>
>
>     Regards,
>
>     Jorge
>
>     Às 10:57 de 13-04-2017, franco base escreveu:
>     > Hi all.
>     > Is it possible that st_distance between point return meter distance if
>     > point are very close and degrees otherwise?
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4553855607023,9.11291318106981) ,4326))
>     >
>     > return 1.3 ( meter distance)
>     >
>     >
>     > SELECT ST_distance ( ST_SetSRID
>     > (ST_MakePoint(45.4553804010375,9.11292550791171) ,4326), ST_SetSRID
>     > (ST_MakePoint(45.4560699405679,9.1164832309759) ,4326))
>     >
>     > return 0.003 (degrees distance)
>     >
>     >
>     > Thanks
>     > fb
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > postgis-users mailing list
>     > [hidden email] <mailto:[hidden email]>
>     > https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>
>     >
>
>     J. Gustavo
>     --
>     Jorge Gustavo Rocha
>     Departamento de Informática
>     Universidade do Minho
>     4710-057 Braga
>     Tel: <a href="tel:%2B351%20253604480" target="_blank">+351 253604480 <<a href="tel:%2B351%20253604480" target="_blank">tel:%2B351%20253604480>
>     Fax: <a href="tel:%2B351%20253604471" target="_blank">+351 253604471 <<a href="tel:%2B351%20253604471" target="_blank">tel:%2B351%20253604471>
>     Móvel: <a href="tel:%2B351%20910333888" target="_blank">+351 910333888 <<a href="tel:%2B351%20910333888" target="_blank">tel:%2B351%20910333888>
>     skype: nabocudnosor
>     _______________________________________________
>     postgis-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.osgeo.org/mailman/listinfo/postgis-users
>     <https://lists.osgeo.org/mailman/listinfo/postgis-users>

>
>
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>


J. Gustavo
--
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: <a href="tel:%2B351%20253604480" target="_blank">+351 253604480
Fax: <a href="tel:%2B351%20253604471" target="_blank">+351 253604471
Móvel: <a href="tel:%2B351%20910333888" target="_blank">+351 910333888
skype: nabocudnosor
_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

 


Garanti sans virus. www.avast.com

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Loading...