How to use the momepy.StreetAlignment 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_distribution.py View on Github external
def test_StreetAlignment(self):
        self.df_buildings["orient"] = orient = mm.Orientation(self.df_buildings).series
        self.df_buildings["street_alignment"] = mm.StreetAlignment(
            self.df_buildings, self.df_streets, "orient", network_id="nID"
        ).series
        self.df_buildings["street_alignment2"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            "orient",
            left_network_id="nID",
            right_network_id="nID",
        ).series
        self.df_buildings["street_a_arr"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series

        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", left_network_id="nID"
            )
        with pytest.raises(ValueError):
github martinfleis / momepy / tests / test_distribution.py View on Github external
self.df_buildings,
            self.df_streets,
            "orient",
            left_network_id="nID",
            right_network_id="nID",
        ).series
        self.df_buildings["street_a_arr"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series

        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", left_network_id="nID"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", right_network_id="nID"
            )
        check = 0.29073888476702336
        assert self.df_buildings["street_alignment"][0] == pytest.approx(check)
        assert self.df_buildings["street_alignment2"][0] == pytest.approx(check)
        assert self.df_buildings["street_a_arr"][0] == pytest.approx(check)
github martinfleis / momepy / tests / test_distribution.py View on Github external
def test_StreetAlignment(self):
        self.df_buildings["orient"] = orient = mm.Orientation(self.df_buildings).series
        self.df_buildings["street_alignment"] = mm.StreetAlignment(
            self.df_buildings, self.df_streets, "orient", network_id="nID"
        ).series
        self.df_buildings["street_alignment2"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            "orient",
            left_network_id="nID",
            right_network_id="nID",
        ).series
        self.df_buildings["street_a_arr"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series

        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
github martinfleis / momepy / tests / test_distribution.py View on Github external
right_network_id="nID",
        ).series
        self.df_buildings["street_a_arr"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series

        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", left_network_id="nID"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", right_network_id="nID"
            )
        check = 0.29073888476702336
        assert self.df_buildings["street_alignment"][0] == pytest.approx(check)
        assert self.df_buildings["street_alignment2"][0] == pytest.approx(check)
        assert self.df_buildings["street_a_arr"][0] == pytest.approx(check)
github martinfleis / momepy / tests / test_distribution.py View on Github external
self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series

        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", left_network_id="nID"
            )
        with pytest.raises(ValueError):
            self.df_buildings["street_alignment"] = mm.StreetAlignment(
                self.df_buildings, self.df_streets, "orient", right_network_id="nID"
            )
        check = 0.29073888476702336
        assert self.df_buildings["street_alignment"][0] == pytest.approx(check)
        assert self.df_buildings["street_alignment2"][0] == pytest.approx(check)
        assert self.df_buildings["street_a_arr"][0] == pytest.approx(check)
github martinfleis / momepy / tests / test_distribution.py View on Github external
def test_StreetAlignment(self):
        self.df_buildings["orient"] = orient = mm.Orientation(self.df_buildings).series
        self.df_buildings["street_alignment"] = mm.StreetAlignment(
            self.df_buildings, self.df_streets, "orient", network_id="nID"
        ).series
        self.df_buildings["street_alignment2"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            "orient",
            left_network_id="nID",
            right_network_id="nID",
        ).series
        self.df_buildings["street_a_arr"] = mm.StreetAlignment(
            self.df_buildings,
            self.df_streets,
            orient,
            left_network_id=self.df_buildings["nID"],
            right_network_id=self.df_streets["nID"],
        ).series
github martinfleis / momepy / benchmarks / bench_distribution.py View on Github external
def time_StreetAlignment(self):
        mm.StreetAlignment(
            self.df_buildings, self.df_streets, "orient", network_id="nID"
        )