def _compute_limits(self, region_id=None):
        """WARNING: probably not yet completely implemented.

        Parameters
        ----------
        region_id: integer or None (default)
            the region id information.

        Returns
        -------
        limits: array_like
            the limits information.

        """
        if region_id is None:
            polygons = tesselation(self.regionlocs)
            whole = ops.unary_union(polygons)
            limits = np.array(whole.bounds).reshape((2, 2)).T
        else:
            polygons = tesselation(self.regionlocs)
            i_r = match_regions(polygons, self.regionlocs)
            regionsid = self.regions_id[i_r]
            p = polygons[np.where(regionsid == region_id)[0]]
            limits = np.array(p.bounds).reshape((2, 2)).T
        return limits
def fit_polygondiscretizer(regionlocs, regions_id):
    polygons = tesselation(regionlocs)
    i_r = match_regions(polygons, regionlocs)
    regionsid = regions_id[i_r]
    return IrregularSpatialDisc(polygons, regionsid)