I have this SQL:

    ST_Distance(GeomFromText('POINT(-0.338767 39.55425)', 4326), geom) dis1,
    ST_Distance(GeomFromText('POINT(-0.338767 39.55425)', 4326), geom, 1) dis2,
    AsEWKT(geom) wkt
from municipios where ID='46117'

with this result:

dis1: 0.0
dis2: 43.4001197100299
wkt: SRID=4326;MULTIPOLYGON(((-0.3383979 39.55284120999999,-0.33985151 39.55334297999999,-0.33885305 39.55501374,-0.33778374 39.55465591,-0.3381158 39.55413200999999,-0.33768222 39.55398242999999,-0.3383979 39.55284120999999)))

I know that ST_Distance ( http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html#p13 ) use different unit when you set the use_ellipsoid parram, but is not 0 a distance that should be 0 in any unit?

  • 1
    Add the result of select AsEWKT(geom) from municipios where ID='28079 into your question. – user30184 Jun 29 at 17:13
  • Might be a bug, the returned distance is the actual distance between the point and the polygon boundary (though it should be 0 since the point is within the polygon) – JGH Jun 30 at 12:48
  • A distance of 0 measured in Euclidean distance might (will) be different when measured on a sphere, as a line between two points (the polygon edge in this case) is not a straight line but a great circle. This effect is more visible over long distances – JGH Jun 30 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.