def particella(x,y): try: catasto = Catasto() landParcel = catasto.findLandParcel(x,y) return catasto.joinGeoJSON(landParcel) except Exception as e: return e
def township(x, y): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() township = catasto.findGeoTownship(x, y) return township
def findcadastry(x, y): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() cadastries = catasto.findGeoCadastry(x, y) return cadastries
def particella(x, y): try: catasto = Catasto() landParcel = catasto.findLandParcel(x, y) return catasto.joinGeoJSON(landParcel) except Exception as e: return e
def getCadastryTownships(): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() cadastries = catasto.listCadastryTownships() return json.dumps(cadastries, ensure_ascii=False).encode('utf-8')
def trovaparticella(): try: ccat = request.query['idcomune'] num = request.query['numparticella'] catasto = Catasto() result = catasto.findLandParcelbyId(num, ccat) return catasto.joinGeoJSON(result) except Exception as e: return e
def trovaparticella(): try: ccat = request.query['idcomune'] num = request.query['numparticella'] catasto = Catasto() result = catasto.findLandParcelbyId(num,ccat) return catasto.joinGeoJSON(result) except Exception as e: return e
def getCValle(ids): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() cvalle = [] idgeom = 0 for id in ids.split(','): cvalle += catasto.findCValleById(id.strip(), idgeom) idgeom += 1 return catasto.joinGeoJSON(cvalle)
def nametownship(ids): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() townships = [] idgeom = 0 for id in ids.split(','): townships += catasto.nameGeoTowhship(id.strip(), idgeom) idgeom += 1 return catasto.joinGeoJSON(townships)
def namecadastry(ids): if request.get_header('Accept') and request.get_header( 'Accept') == 'application/json': response.content_type = 'application/json' catasto = Catasto() cadastries = [] idgeom = 0 for id in ids.split(','): cadastries += catasto.findGeoCadastryById(id.strip(), idgeom) idgeom += 1 return catasto.joinGeoJSON(cadastries)
def namecadastry(id): catasto = Catasto() name = catasto.dataCadastryTownship(id) amm = catasto.nameTownship(name[0][1]) d = { 'id_amministrativo':name[0][1], 'comune_amministrativo': amm[0][0], 'comune_catastale': name[0][0], 'centroidX': name[0][2], 'centroidY': name[0][3], 'id_comune_catastale':id} return json.dumps(d)
def namecadastry(id): catasto = Catasto() name = catasto.dataCadastryTownship(id) amm = catasto.nameTownship(name[0][1]) d = { 'id_amministrativo': name[0][1], 'comune_amministrativo': amm[0][0], 'comune_catastale': name[0][0], 'centroidX': name[0][2], 'centroidY': name[0][3], 'id_comune_catastale': id } return json.dumps(d)
def test(): try: y = '46.06683' x = '11.12164' y = '46.05867' x = '11.11297' #?z=19 catasto = Catasto() landParcel = catasto.findLandParcel(x,y) print len(landParcel) print landParcel cadastry = catasto.findCadastry(x,y) comune = catasto.findTownship(x,y) print cadastry print comune dimmi = catasto.touch(catasto.ammcat,catasto.ammcat_id,catasto.ammcat_label,x,y) print dimmi return "<a href='./api/particella/46.06683/11.12164'>particella/</a>" except Exception as e: print(e)
def do_upload(): upload = request.files.get('upload') data = request.files.upload name, ext = os.path.splitext(upload.filename) if ext not in ('.png','.jpg','.jpeg'): return 'File extension not allowed.' save_path = os.path.curdir + os.sep + "www" + os.sep + "photos" + os.sep + upload.filename if os.path.isfile(save_path): os.remove(save_path) with open(save_path, 'w') as open_file: open_file.write(data.file.read()) open_file.close() p = Photo(save_path) geoposition = [] if p.latitudine != None: geoposition.append(str(p.getGeoJSON())) catasto = Catasto() particelle = catasto.findLandParcel(p.longitudine,p.latitudine) for p in particelle: geoposition.append(p) geoposition = catasto.joinGeoJSON(geoposition) return str(geoposition)
def do_upload(): upload = request.files.get('upload') data = request.files.upload name, ext = os.path.splitext(upload.filename) if ext not in ('.png', '.jpg', '.jpeg'): return 'File extension not allowed.' save_path = os.path.curdir + os.sep + "www" + os.sep + "photos" + os.sep + upload.filename if os.path.isfile(save_path): os.remove(save_path) with open(save_path, 'w') as open_file: open_file.write(data.file.read()) open_file.close() p = Photo(save_path) geoposition = [] if p.latitudine != None: geoposition.append(str(p.getGeoJSON())) catasto = Catasto() particelle = catasto.findLandParcel(p.longitudine, p.latitudine) for p in particelle: geoposition.append(p) geoposition = catasto.joinGeoJSON(geoposition) return str(geoposition)
def findcadastry(x, y): catasto = Catasto() cadastries = catasto.findGeoCadastry(x, y) return cadastries
def township(x, y): catasto = Catasto() township = catasto.findGeoTownship(x, y) return township
def nametownship(id): catasto = Catasto() return catasto.nameGeoTowhship(id)
def township(x,y): catasto = Catasto() township = catasto.findGeoTownship(x,y) return township
def getCadastryTownships(): catasto = Catasto() cadastries = catasto.listCadastryTownships() return json.dumps(cadastries)
def findcadastry(x,y): catasto = Catasto() cadastries = catasto.findGeoCadastry(x,y) return cadastries