def scrapeClient(client, db, c): data = {} if client[2] is not None: # print "calling EDGAR" data["EDGAR"] = EDGAR.scrape(client[2]) if client[3] is not None: # print "calling FDIC" data["FDIC"] = FDIC.scrape(client[3]) if client[4] is not None: # print "calling FINRA" data["FINRA"] = FINRA.scrape(client[4]) if client[5] is not None: # print "calling GMEI" data["GMEI"] = GMEI.scrape(client[5]) if client[6] is not None: # print "calling NIC" data["NIC"] = NIC.scrape(client[6]) if client[7] is not None: # print "calling SEC" data["SEC"] = SEC.scrape(client[7]) if client[9] is not None: # print "calling SEC" data["FCA"] = FCA.scrape(client[8]) if client[10] is not None: # print "calling SEC" data["Beta"] = Beta.scrape(client[9]) d = json.dumps(data) timestamp = strftime("%Y-%m-%d %H:%M:%S", gmtime()) log = (client[0], timestamp, str(d)) return log
import fiona import shapely import math import SEC from shapely.geometry import shape, mapping outputDataset = r"C:\temp\week8\Cityi10.shp" with fiona.open(outputDataset, 'r') as c: print c.schema for rec in c: coordlist = [] newgeo = mapping(shape(rec["geometry"]).buffer(1)) rings = newgeo["coordinates"] print type(rings), len(rings), rec["properties"]["NAME10"] for ring in rings: for coord in ring: coordlist.append(coord) try: minCircle = SEC.make_circle(coordlist) except: print "didn't work"
cperimeter = math.sqrt(area / math.pi) * 2 * math.pi scircle = (cperimeter / perimeter) pointList = [] #calculate circle buf = row[1].buffer(0.01) for part in buf: for coord in part: try: pointList.append((coord.X, coord.Y)) except: print "Bad Point" c = SEC.make_circle(pointList) print c circlearea = math.pi * c[2] * c[2] ccircle = area / circlearea print ptoa, shapeindex, scircle, ccircle cp = arcpy.PointGeometry(arcpy.Point(c[0],c[1])) polygonbuf = row[1].buffer(100) row[1] = polygonbuf.difference(row[1]) row[2] = ptoa row[3] = shapeindex row[4] = ccircle row[5] = scircle cursor.updateRow(row)
# Step through each vertex in the feature # for pnt in part: if pnt: # Print x,y coordinates of current point # points.append((pnt.X, pnt.Y)) #print("{0}, {1}".format(pnt.X, pnt.Y)) else: # If pnt is None, this represents an interior ring # pass #print("Interior Ring:") partnum += 1 try: circledef = SEC.make_circle(points) cp = arcpy.PointGeometry(arcpy.Point(circledef[0], circledef[1])) scc = cp.buffer(circledef[2]) #HOW TO CALCULATE??? CIRCLE = geo.area / scc.area print row[0], CIRCLE row[1] = scc cursor.updateRow(row) except: print row[0] + " Did not work" del cursor, row