Ejemplo n.º 1
0
def getNumJPGInRange(lat, lon, inputDir, radius, files):
    """counts all images in inputDir within radius of given coordinate makes assumption about format of filename"""
    if os.path.exists(inputDir):
        count = 0
        for file in files:
            lat2, lon2 = info.getImgCoord(str(file))
            dist = info.distance(lat, lon, lat2, lon2)
            if(dist < radius):
                count+=1
        return count
    else:
        raise OSError("{p} does not exist.".format(p=inputDir))
Ejemplo n.º 2
0
def copyJPGInRange(lat, lon, inputDir, outputDir, radius, files):
    """puts all images in inputDir within radius of given coordinate into outputDir.
    makes assumption about format of filename"""
    if not os.path.exists(outputDir):
        try:
            os.makedirs(outputDir)
        except Exception:
            print "Error making directory...quitting..."
            return
    for file in files:
        lat2, lon2 = info.getImgCoord(str(file))
        dist = info.distance(lat, lon, lat2, lon2)
        if(dist < radius):
            os.symlink(os.path.join(os.path.abspath(inputDir + '/'), file), os.path.join(outputDir + '/', file))
Ejemplo n.º 3
0
def writedbImgCoords(dbdir="E:/Research/collected_images/earthmine-new,culled/37.871955,-122.270829/",
                     fname = "E:/dl.txt"):
    """writes coordinates for all database jpegs in path into a file fname for use in google earth"""
    if not os.path.exists(dbdir):
        return
    f = open(fname, "w")
    coords = []
    files = getJPGFileNames(dbdir)
    print len(files)
    for file in files:
        coord = info.getImgCoord(file)
        if  coord not in coords:
            coords.append(coord)
    for lat, lon in coords:
        f.write(', ,' + str(lon) + ',' + str(lat) + '' + '\n')
    f.close()