Finalizado y testado localmente el modulo de Geocoding, listo
para probar en entorno integrado.
This commit is contained in:
parent
238b0f5305
commit
3a4a4fc195
4 changed files with 358 additions and 206 deletions
|
|
@ -58,6 +58,48 @@ class CapturasInterface():
|
|||
except:
|
||||
return None
|
||||
|
||||
def not_geocoded_captura_exists(self):
|
||||
query_statement = """
|
||||
SELECT *
|
||||
FROM anuncios.capturas
|
||||
WHERE `precision` IS NULL
|
||||
LIMIT 1"""
|
||||
|
||||
cursor_result = self.anunciosdb.query(query_statement, dictionary=True)
|
||||
try:
|
||||
result = cursor_result.fetchone()
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def get_not_geocoded_captura(self):
|
||||
query_statement = """
|
||||
SELECT *
|
||||
FROM anuncios.capturas
|
||||
WHERE `precision` IS NULL
|
||||
LIMIT 1
|
||||
"""
|
||||
|
||||
cursor_result = self.anunciosdb.query(query_statement, dictionary=True)
|
||||
try:
|
||||
return cursor_result.fetchone()
|
||||
except:
|
||||
return None
|
||||
|
||||
def update_geo_data(self, referencia, fecha_captura, latitude, longitude, precision):
|
||||
query_statement = """
|
||||
UPDATE anuncios.capturas
|
||||
SET latitud = %(latitud)s, longitud = %(longitud)s, `precision` = %(precision)s
|
||||
WHERE referencia = %(referencia)s AND fecha_captura = %(fecha_captura)s
|
||||
"""
|
||||
query_parameters = {'referencia': referencia,
|
||||
'fecha_captura': fecha_captura,
|
||||
'latitud': latitude,
|
||||
'longitud': longitude,
|
||||
'precision': precision}
|
||||
|
||||
self.anunciosdb.query(query_statement, query_parameters)
|
||||
|
||||
|
||||
capturas_interface = CapturasInterface()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue