I have a table named coords with the following columns |name|lat|lon|und|
import sqlite3
database = sqlite3.connect('geoida.db')
cursor = database.cursor()
cursor.execute("select lat, lon, und from coords")
results = cursor.fetchall()
every line in table stores coordinates of one point of g r i d and distance from point to point is always in decimal 0.041667,
what is equal to 2.5''.
What I would like to achieve is to find 4 nearest adjacent points around given latitude and longitude in decimal.
We have to keep in mind that latitude and longitude of these four points have to fill quite simple condition:
excess between lat, lon of adjacent point and lat, lon
of given point must be less/equal 0.041667 on + or -
or we can treat this value as max radius divisive sought neighboring points from the given one.
for example:
for given point 56.02050000 13.02040000
4 nearest adjacent points taken from my coords table are:
56.000000 13.000000
56.000000 13.041667
56.041667 13.000000
56.041667 13.041667
Given points are stored in another database, where C1 is latitude and C2 is longitude
database = sqlite3.connect('F.tsj')
cursor = database.cursor()
cursor.execute("select C1, C2 from tblSoPoints")
results = cursor.fetchall()
How can I put such query using python?
Sorry for code but there's something wrong with formating.