问题
I am new to Spatialite. I have following query:
select A.*
from linka as A, pointa as B
where Contains(Buffer(B.Geometry, 100), A.Geometry)
I actually want to create 100 meters buffer and get to know which are the link's are contained by it.
I can able to find the inserted '100' is actually degree value and it's giving me output which are coming in this range.
I can put the degree value also in my query but the transformation from degree to meters/kilometers is not same all around the world. I gone through many sites and able to know 1 degree = 110 KM approx. but from GIS expert and some reference sites also get to know at each pole on earth it's different.
For instance, the difference at Alta/Norway between metrical x and y for planar approximation is 34 km in x direction equal 111 km in y direction. The buffer looks similar to this while using geographic coordinates:
http://extremelysatisfactorytotalitarianism.com/blog/wp-content/uploads/2010/08/tissot_indicatrix_equirectangular_proj.png
I build software which convert geographical data to geometrical (X, Y -coordinate format) data and make transformation where Spatiallite can understand.
I also trying to read regarding SRID things but not able to understand how to insert it into my query.
回答1:
temporary transform your geometry to a metric projection (eg UTM) if i assume your current projection is WGS84 try the following statment
transform (buffer (transform (B.geometry, #projection), #dist), 4326))
-in #projection: your new projection, eg: 32631 for WGS 84 / UTM zone 31N (choose the projection that fits your Zone)
-in #dist: distance in meters
(4326 for WGS84)
回答2:
If You are using SQL server 2008 or later, You should be able to use spatial types
- lets assume linka contains geography column, and its name is geo, and it contains Points
- dont forget to create spatial index !
try this
DECLARE @buffer geography = geography::Point( 1.234, 5.678, 4326 ); DECLARE @distance float = 100.0;
SELECT * from linka WHERE linka.geo.STDistance(@buffer) < @distance
来源:https://stackoverflow.com/questions/21882853/gis-buffer-value-degree-to-meters-with-spatiallite