Citar y Licencia: https://doi.org/10.6084/m9.figshare.27329844.v1
VÃdeo: https://youtu.be/7Xd9kPBTZRw
geom
geometry
geography
Soportan las mismas funciones (ST_Length
,
ST_Area
)
geography
más lento que
geometry
geography
no forma parte de OGC
Ciudad | Código Postal | Calle | Número | geom |
---|---|---|---|---|
Madrid | 28013 | Prta del Sol | 7 | POINT(-3.7038, 40.4166) |
Barcelona | 08007 | Pg. de Grà cia | 43 | POINT(2.1649, 41.3917) |
Granada | 18009 | C. Mariana Pineda | 21 | POINT(-3.5982, 37.1751) |
SELECT
d1.id AS punto1_id,
d2.id AS punto2_id,
ST_Distance(d1.geom::geography,
d2.geom::geography) AS m_geog,
ST_Distance(ST_Transform(d1.geom, 25830),
ST_Transform(d2.geom, 25830)) AS m_geom,
ST_Distance(d1.geom, d2.geom) AS gr_geom
FROM
direcciones AS d1,
direcciones AS d2
WHERE
d1.id < d2.id;
punto1_id | punto2_id | m_geog | m_geom | gr_geom |
---|---|---|---|---|
1 | 2 | 506093.13598968 | 506231.6361476034 | 5.949220089752805 |
1 | 3 | 359967.76000813 | 359837.8955218233 | 3.243279523994537 |
2 | 3 | 682634.00542604 | 682826.9493757648 | 7.141047288923869 |
SELECT g.d_geog, m.d_geom
FROM (SELECT
ST_Distance(
ST_SetSRID(ST_Point(180, 0), 4326)::geography,
ST_SetSRID(ST_Point(-180, 0), 4326)::geography
) as d_geog) AS g,
(SELECT
ST_Distance(
ST_SetSRID(ST_Point(180, 0), 4326),
ST_SetSRID(ST_Point(-180, 0), 4326)
) as d_geom) AS m;
d_geog | d_geom |
---|---|
0 | 360 |