How to use the tilecloud.__init__.Bounds function in tilecloud

To help you get started, we’ve selected a few tilecloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
z1 = int(match.group("z1"))
        x1 = int(match.group("x1"))
        if match.group("starx"):
            x2 = 1 << z1
        elif match.group("plusx"):
            x2 = x1 + int(match.group("x2"))
        else:
            x2 = int(match.group("x2"))
        y1 = int(match.group("y1"))
        if match.group("stary"):
            y2 = 1 << z1
        elif match.group("plusy"):
            y2 = y1 + int(match.group("y2"))
        else:
            y2 = int(match.group("y2"))
        result = cls({z1: (Bounds(x1, x2), Bounds(y1, y2))})
        if match.group("z2"):
            z2 = int(match.group("z2"))
            if match.group("plusz"):
                z2 += z1
            if z1 < z2:
                result.fill_down(z2)
            elif z1 > z2:
                result.fill_up(z2)
        return result
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def add(self, tilecoord):
        """Extends self to include tilecoord"""
        if tilecoord.z in self.bounds:
            xbounds, ybounds = self.bounds[tilecoord.z]
            xbounds.add(tilecoord.x)
            ybounds.add(tilecoord.y)
        else:
            self.bounds[tilecoord.z] = (Bounds(tilecoord.x), Bounds(tilecoord.y))
        return self
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def full(cls, zmin=None, zmax=None):
        assert zmax is not None
        zs = (zmax,) if zmin is None else range(zmin, zmax + 1)
        return cls(dict((z, (Bounds(0, 1 << z), Bounds(0, 1 << z))) for z in zs))
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def union(self, other):
        """Returns a new Bounds which is the union of self and other"""
        if self and other:
            return Bounds(min(self.start, other.start), max(self.stop, other.stop))
        elif self:
            return Bounds(self.start, self.stop)
        elif other:
            return Bounds(other.start, other.stop)
        else:
            return Bounds()
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def union(self, other):
        """Returns a new Bounds which is the union of self and other"""
        if self and other:
            return Bounds(min(self.start, other.start), max(self.stop, other.stop))
        elif self:
            return Bounds(self.start, self.stop)
        elif other:
            return Bounds(other.start, other.stop)
        else:
            return Bounds()
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def union(self, other):
        """Returns a new Bounds which is the union of self and other"""
        if self and other:
            return Bounds(min(self.start, other.start), max(self.stop, other.stop))
        elif self:
            return Bounds(self.start, self.stop)
        elif other:
            return Bounds(other.start, other.stop)
        else:
            return Bounds()
github camptocamp / tilecloud / tilecloud / __init__.py View on Github external
def union(self, other):
        """Returns a new Bounds which is the union of self and other"""
        if self and other:
            return Bounds(min(self.start, other.start), max(self.stop, other.stop))
        elif self:
            return Bounds(self.start, self.stop)
        elif other:
            return Bounds(other.start, other.stop)
        else:
            return Bounds()