예제 #1
0
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 particella(x,y):
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x,y)  
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
예제 #3
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
예제 #4
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
예제 #5
0
def particella(x, y):
    if request.get_header('Accept') and request.get_header(
            'Accept') == 'application/json':
        response.content_type = 'application/json'
    try:
        catasto = Catasto()
        landParcel = catasto.findLandParcel(x, y)
        return catasto.joinGeoJSON(landParcel)
    except Exception as e:
        return e
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
0
def trovaparticella():
    if request.get_header('Accept') and request.get_header(
            'Accept') == 'application/json':
        response.content_type = 'application/json'
    try:
        ccat = request.query['idcomune']
        nums = request.query['numparticella'].split(',')
        catasto = Catasto()
        parcels = []
        for num in nums:
            parcels += catasto.findLandParcelbyId(num.strip(), ccat)
        idgeom = 0
        for parcel in parcels:
            parcel['geometry']['id'] = idgeom
            parcel['id'] = idgeom
            idgeom += 1
        return catasto.joinGeoJSON(parcels)
    except Exception as e:
        return e
예제 #10
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)
예제 #11
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)