When I worked with PostGIS I used geography type for geo objects with gps coordinates like latitude and longitude on the WGS-84 ellipsoid. Now I have to use SQLite and libspatialite correspondingly. I wonder, if I create column like this:
Select AddGeometryColumn ('my_table', 'Geometry', 4326, 'POINT', 2)
will queries with ST_Within/ST_Contains(geo_rect, my_table.geometry)
find suitable
points if geo_rect
covers north pole, or 0,180 longitude?
here how it works in postgis:
geo_demo=# select ST_DWithin(ST_GeographyFromText('POLYGON((-179 53, 179 53, 179 50, -179 50, -179 53))'), ST_GeographyFromText('POINT(-179 61)'), 1.0, true);
st_dwithin
------------
f
(1 row)
geo_demo=# select ST_DWithin(ST_GeographyFromText('POLYGON((-179 53, 179 53, 179 50, -179 50, -179 53))'), ST_GeographyFromText('POINT(-179 51)'), 1.0, true);
st_dwithin
------------
t
(1 row)
geo_demo=#
as you see point with latitude 51,-179.5 inside geo box:
53, -179 <-> 53,179
50, -179 <-> 50,179
but
spatialite> select Within(MakePoint(-179.5, 51, 4326), PolyFromText('POLYGON((-179 53, 179 53, 179 50, -179 50, -179 53))', 4326));
0
gives 0, but really point inside geo box.
50 < 51 < 53
and longitude-179.5
lay between-179
and179
st_dwithin
for geography type takedistance_meters
not in degrees, see postgis.net/docs/ST_DWithin.html