def get_cover(self, union=True): if union: for g in self.ap_groups: polygons = [] alt_m_sum = 0 for ap in g: alt_m_sum += ap.alt_m polygons.append(ap.poly) poly = cascaded_union(polygons) avg_alt_m = float(alt_m_sum) / (len(g) or 1) self.polys.append({ 'aps': g, 'alt_m': avg_alt_m, 'shape': poly }) else: for ap in self.ap_list: self.polys.append({ 'aps': ap, 'alt_m': ap.alt_m, 'shape': ap.poly }) for poly in self.polys: pcoords = poly['shape'].exterior.coords print(pcoords[0]) pcoords = coordutil.fix(pcoords, poly['alt_m']) print(pcoords[0]) self.coords.append(pcoords)
def get_cover(self, radius_m=None): if not radius_m: radius = self.radius else: radius = radius_m * geo.m1_lat p = Point(self.lat, self.lon, self.alt_m) self.poly = p.buffer(radius) c = self.poly.exterior.coords self.cover_points = coordutil.fix(c, self.alt_m)
def get_cover(self, union=True): if union: for g in self.ap_groups: polygons = [] alt_m_sum = 0 for ap in g: alt_m_sum += ap.alt_m polygons.append(ap.poly) poly = cascaded_union(polygons) avg_alt_m = float(alt_m_sum)/(len(g) or 1) self.polys.append({'aps':g, 'alt_m':avg_alt_m, 'shape':poly}) else: for ap in self.ap_list: self.polys.append({'aps':ap, 'alt_m':ap.alt_m,'shape':ap.poly}) for poly in self.polys: pcoords = poly['shape'].exterior.coords print(pcoords[0]) pcoords = coordutil.fix(pcoords, poly['alt_m']) print(pcoords[0]) self.coords.append(pcoords)