예제 #1
0
def updateGps(image_id, GPS, lat, lon):
	
	statement = "INSERT INTO gps (id, area, lat, lon) VALUES (" + str(image_id) +", 'center'," + str(lat) + "," + str(lon) + ")"
	db.query_db(statement, 'EDIT')
	
	
	spots = ["top right", "top left", "bottom right", "bottom left"]
	
	
	for index, spot in enumerate(spots):
		statement = "INSERT INTO gps (id, area, lat, lon) VALUES (" + str(image_id) +"," + spot + "," + str(GPS[index][0]) + "," + str(GPS[index][1]) + ")"
		db.query_db(statement, 'EDIT')
예제 #2
0
def check_uploads(baseName):
    statement = "SELECT * from errorfiles where BaseName=" + "'" + baseName + "'"
    result = db.query_db(statement, 'SELECT')
    if (len(result) != 0):
        return False

    statement = "SELECT BaseName from currentfiles where BaseName=" + "'" + baseName + "'"
    result = db.query_db(statement, 'SELECT')
    if (len(result) != 0):
        print(baseName + " being stacked by another machine")
        return False

    statement = "SELECT image_id from images where image_name=" + "'" + baseName + "stacked.tiff" + "'"
    result = db.query_db(statement, 'SELECT')
    if (len(result) != 0):
        print(baseName + ' already stacked')
        return False
    else:
        print('pulling' + basename + ' to be stacked')
        return True
예제 #3
0
def updateDatabase(filename, bombCoors):
	filepath = directory + filename
	img = metadata.Metadata(filepath)
	lat = img.get_item('Composite:GPSLatitude')
	lon = img.get_item('Composite:GPSLongitude')
	yaw, pitch, roll = img.dls_pose()
	alt = img.get_item('Composite:GPSAltitude')
	elevation = getElevation(str(lat),str(lon))
	
	image_name = filename.split('.')[0][:-2] + '_stacked.tiff'
	
	image_id = newImgId()
	
	statement = "INSERT INTO  images (image_id, image_name, yaw, pitch, roll, height) VALUES(" + str(image_id) + ", '"+  image_name  + "', " + str(yaw) + "," + str(pitch) + "," + str(roll) +  "," + str(height) + ")"
	
	result = db.query_db (statement, 'EDIT')
	
	GPS, bombs = checkingIfBomb(getGPS(img, elevation, lat, lon, alt), bombCoors)
	
	updateGps(image_id, GPS, lat, lon)
	updateBombs(image_id, bombs)
예제 #4
0
def post_current_file(baseName):

    statement = "Update currentfiles set BaseName=" + "'" + baseName + "', time=Now() where  MAC=" + "'" + gma(
    ) + "'"
    result = db.query_db(statement, 'EDIT')
예제 #5
0
def update_errorFiles(baseName):
    statement = "INSERT INTO  errorfiles (BaseName) VALUES(" + "'" + baseName + "'" + ")"
    result = db.query_db(statement, 'EDIT')
예제 #6
0
import dp_connect as db
from getmac import get_mac_address as gma
baseName = "test1"
MAC = gma()
#print(MAC)
#statement = "INSERT INTO  currentfiles (BaseName, MAC) VALUES(" + "'"+  baseName  + "','" + gma() + "' )"
#statement = "SELECT max(image_id) from images"

image_id = -1
image_name = "test"
yaw = -2
pitch = -3
roll = -4
height = -5
#statement = "INSERT INTO  images (image_id, image_name, yaw, pitch, roll, height) VALUES(" + str(image_id) + ", '"+  image_name  + "', " + str(yaw) + "," + str(pitch) + "," + str(roll) +  "," + str(height) + ")"
"""
"INSERT INTO gps (id, area, lat, lon) VALUES (" + str(image_id) +", 'center'," 


print(statement)
result = db.query_db (statement, 'EDIT', True)
print(result)
"""
statement = "SELECT * from currentfiles where BaseName=" + "'" + baseName + "'"
print(statement)
result = db.query_db(statement, 'SELECT', True)
print(result)
if (len(result) != 0):
    print(baseName + " being stacked by another machine")
예제 #7
0
def updateBombs(image_id,bombs):
	for index, bomb in enumerate(bombs):
		statement = "INSERT INTO image_bombs (image_id, bomb_id, lat, lon) VALUES (" + str(image_id) + "," + str(index) + "," + str(lat) + "," + str(lon) + ")"
		db.query_db(statement, 'EDIT')
예제 #8
0
def newImgId():
	statement = "SELECT max(image_id) from images"
	
	result = db.query_db (statement, 'SELECT')
	return result[0]['max(image_id)'] + 1