Search code examples
sqlbuffergisgeospatialspatialite

GIS buffer value degree to meters with spatiallite


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.


Solution

  • 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)