예제 #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 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
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
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)