Пример #1
0
def get_border_cell(s2_id):
    locs = []
    s2_cell = Cell(s2_id)
    for i in [0, 1]:
        for j in [0, 1]:
            locs.append([s2_cell.get_latitude(i, j) * 180 / pi, s2_cell.get_longitude(i, j) * 180 / pi])
    output = [locs[0], locs[1], locs[3], locs[2], locs[0]]
    return output
Пример #2
0
def get_border_cell(s2_id):
    locs = []
    s2_cell = Cell(s2_id)
    for i in [0, 1]:
        for j in [0, 1]:
            locs.append([
                s2_cell.get_latitude(i, j) * 180 / pi,
                s2_cell.get_longitude(i, j) * 180 / pi
            ])
    output = [locs[0], locs[1], locs[3], locs[2], locs[0]]
    return output
Пример #3
0
    def cover_cell(self, cid):
        lats = []
        lngs = []
        output = []
        s2_cell = Cell(cid)
        lvl = s2_cell.level()
        for i in [0, 1]:
            for j in [0, 1]:
                lats.append(s2_cell.get_latitude(i, j)/pi*180)
                lngs.append(s2_cell.get_longitude(i, j)/pi*180)
        locations = self.cover_region((min(lats),min(lngs)),(max(lats),max(lngs)))
        for location in locations:
            testid = CellId.from_lat_lng(LatLng.from_degrees(location[0],location[1])).parent(lvl)
            if testid == cid:
                output.append(location)

        return output
Пример #4
0
    def cover_cell(self, cid):
        lats = []
        lngs = []
        output = []
        s2_cell = Cell(cid)
        lvl = s2_cell.level()
        for i in [0, 1]:
            for j in [0, 1]:
                lats.append(s2_cell.get_latitude(i, j) / pi * 180)
                lngs.append(s2_cell.get_longitude(i, j) / pi * 180)
        locations = self.cover_region((min(lats), min(lngs)),
                                      (max(lats), max(lngs)))
        for location in locations:
            testid = CellId.from_lat_lng(
                LatLng.from_degrees(location[0], location[1])).parent(lvl)
            if testid == cid:
                output.append(location)

        return output