コード例 #1
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
def particella(x,y):
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x,y)  
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
コード例 #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
コード例 #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
コード例 #4
0
def particella(x, y):
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x, y)
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
コード例 #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')
コード例 #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
コード例 #7
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
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
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #11
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
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)
コード例 #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)
コード例 #13
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
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)
コード例 #14
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
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)
コード例 #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)
コード例 #16
0
def findcadastry(x, y):
    catasto = Catasto()
    cadastries = catasto.findGeoCadastry(x, y)
    return cadastries
コード例 #17
0
def township(x, y):
    catasto = Catasto()
    township = catasto.findGeoTownship(x, y)
    return township
コード例 #18
0
def nametownship(id):
    catasto = Catasto()
    return catasto.nameGeoTowhship(id)
コード例 #19
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
def nametownship(id):
    catasto = Catasto()
    return catasto.nameGeoTowhship(id)
コード例 #20
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
def township(x,y):
    catasto = Catasto()
    township = catasto.findGeoTownship(x,y)
    return township
コード例 #21
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
def getCadastryTownships():
    catasto = Catasto()
    cadastries = catasto.listCadastryTownships()
    return json.dumps(cadastries)
コード例 #22
0
def getCadastryTownships():
    catasto = Catasto()
    cadastries = catasto.listCadastryTownships()
    return json.dumps(cadastries)
コード例 #23
0
ファイル: tawolare.py プロジェクト: CristianCantoro/tawolare
def findcadastry(x,y):
    catasto = Catasto()
    cadastries = catasto.findGeoCadastry(x,y)
    return cadastries