Sunday 15 January 2017

sqlite - Create Buffer in meters Spatialite query


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)



Here,



A.Geometry = LINESTRING(23.2161 69.95237, 23.21581 69.95279) B.Geometry = POINT(23.21817 69.95177)



I want to create 100 meters buffer and get to know which are the link's are contained by point geometry.


I am having coordinates of WGS 84 projection system from navigation data.


The passing 100 over here, it takes as degree and creating buffer like that, but I actually want to specify the buffer distance as meters. (I don't want to pass the distance in degree value because on each earth pole degree's buffer cover not same range area. This is the big problem of geodecy)


Is there any way to satisfy my requirement in Spatialite ?



Answer



I think you will have to transform your table geometry to a projected coordinates system before doing your buffer for instance SÄ¥erical Mercator (EPSG:3857)



Note that Spherical Mercator projection wont be precise, so I suggest using a local projection.


see transform function here


ST_Transform( A.geometry , 3857 ) 

ST_Transform( B.geometry , 3857 )

you can do it in one query like this (not tried):


select A.* from linka as A, pointa as B where Contains(Buffer(ST_Transform( B.geometry , 3857 ), 100), ST_Transform( A.geometry , 3857 ))

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...