How to use the momepy.buffered_limit function in momepy

To help you get started, we’ve selected a few momepy 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 martinfleis / momepy / tests / test_elements.py View on Github external
def test__split_lines(self):
        large = mm.buffered_limit(self.df_buildings, 100)
        dense = mm.elements._split_lines(large, 100)
        small = mm.buffered_limit(self.df_buildings, 30)
        dense2 = mm.elements._split_lines(small, 100)
        assert len(dense) == 53
        assert len(dense2) == 51
github martinfleis / momepy / tests / test_utils.py View on Github external
def test_snap_street_network_edge(self):
        snapped = mm.snap_street_network_edge(
            self.df_streets, self.df_buildings, 20, self.df_tessellation, 70
        )
        snapped_nonedge = mm.snap_street_network_edge(
            self.df_streets, self.df_buildings, 20
        )
        snapped_edge = mm.snap_street_network_edge(
            self.df_streets,
            self.df_buildings,
            20,
            tolerance_edge=70,
            edge=mm.buffered_limit(self.df_buildings, buffer=50),
        )
        assert sum(snapped.geometry.length) == 5980.041004739525
        assert sum(snapped_edge.geometry.length) == 5980.718889937014
        assert sum(snapped_nonedge.geometry.length) < 5980.041004739525
github martinfleis / momepy / tests / test_elements.py View on Github external
def test__split_lines(self):
        large = mm.buffered_limit(self.df_buildings, 100)
        dense = mm.elements._split_lines(large, 100)
        small = mm.buffered_limit(self.df_buildings, 30)
        dense2 = mm.elements._split_lines(small, 100)
        assert len(dense) == 53
        assert len(dense2) == 51
github martinfleis / momepy / tests / test_elements.py View on Github external
def setup_method(self):

        test_file_path = mm.datasets.get_path("bubenec")
        self.df_buildings = gpd.read_file(test_file_path, layer="buildings")
        self.df_tessellation = gpd.read_file(test_file_path, layer="tessellation")
        self.df_streets = gpd.read_file(test_file_path, layer="streets")
        self.df_streets["nID"] = range(len(self.df_streets))
        self.limit = mm.buffered_limit(self.df_buildings, 50)
github martinfleis / momepy / tests / test_elements.py View on Github external
def test_Tessellation(self):
        tes = mm.Tessellation(self.df_buildings, "uID", self.limit, segment=2)
        tessellation = tes.tessellation
        assert len(tessellation) == len(self.df_tessellation)
        bands = mm.Tessellation(
            self.df_streets, "nID", mm.buffered_limit(self.df_streets, 50), segment=5
        ).tessellation
        assert len(bands) == len(self.df_streets)
        queen_corners = tes.queen_corners(2)
        w = libpysal.weights.Queen.from_dataframe(queen_corners)
        assert w.neighbors[14] == [35, 36, 13, 15, 26, 27, 28, 30, 31]