resolution = 7 # default resolution # vary resolution based on area so bigger areas have bigger cells if area < 10: resolution = 12 elif area > 10 and area < 1000.0: resolution = 8 elif area > 1000.0 and area < 30000.0: resolution = 6 elif area > 30000: resolution = 4 print('using resolution ', resolution) # calculate the approx cell width at this resolution thisWidthApprox = rdggs.cell_width( resolution, plane=True ) # note only approx because we are using the planar to estimate elipsoidal print('++++++++++ Cell width approx +++', thisWidthApprox, 'm') thisLGA = feature.record[1] thisName = feature.record[2] # call the "call_DGGS" function to return all the DGGS cells (within polygon only) cells_in_poly = call_DGGS.poly_to_DGGS_tool(polyShape, polyRecord, resolution) print('number in polygon = ', len(cells_in_poly)) print('Reducing . . . ') # reduce to biggest cells theseReducedCells = call_DGGS.coalesce(cells_in_poly) #print('reduced cells =', theseReducedCells) print('number reduced cells =', len(theseReducedCells))
longi = float(row[4]) lati = float(row[3]) # feed lat long into convertor #Pick a (longitude-latitude) point on the ellipsoid and find the cell that contains it :: t = (longi, lati) #figure resolution to use using longitude strLongi = str(longi) # convert longi to string strLati = str(lati) resolution = 10 plane = False # on curve w = rdggs.cell_width(resolution) if plane: area = w**2 else: area = 8 / (3 * math.pi) * w**2 # change to metres with one decimal place w = (" %2.0f m" % (w)) # print () # calculate the dggs cell from long and lat ie t thisCell = rdggs.cell_from_point( resolution, t, plane=False) # false = on the curve dggsCell = str(thisCell) #find the boundary for exporting into ESRI or GDAL