Exemplo n.º 1
0
def particella(x,y):
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x,y)  
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
def particella(x, y):
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x, y)
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
Exemplo n.º 5
0
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')
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
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)
Exemplo n.º 15
0
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)
Exemplo n.º 16
0
def findcadastry(x, y):
    catasto = Catasto()
    cadastries = catasto.findGeoCadastry(x, y)
    return cadastries
Exemplo n.º 17
0
def township(x, y):
    catasto = Catasto()
    township = catasto.findGeoTownship(x, y)
    return township
Exemplo n.º 18
0
def nametownship(id):
    catasto = Catasto()
    return catasto.nameGeoTowhship(id)
Exemplo n.º 19
0
def nametownship(id):
    catasto = Catasto()
    return catasto.nameGeoTowhship(id)
Exemplo n.º 20
0
def township(x,y):
    catasto = Catasto()
    township = catasto.findGeoTownship(x,y)
    return township
Exemplo n.º 21
0
def getCadastryTownships():
    catasto = Catasto()
    cadastries = catasto.listCadastryTownships()
    return json.dumps(cadastries)
Exemplo n.º 22
0
def getCadastryTownships():
    catasto = Catasto()
    cadastries = catasto.listCadastryTownships()
    return json.dumps(cadastries)
Exemplo n.º 23
0
def findcadastry(x,y):
    catasto = Catasto()
    cadastries = catasto.findGeoCadastry(x,y)
    return cadastries