Exemplo n.º 1
0
 def test_Alignment(self):
     self.df_buildings["orient"] = mm.Orientation(self.df_buildings).series
     sw = Queen.from_dataframe(self.df_tessellation, ids="uID")
     self.df_buildings["align_sw"] = mm.Alignment(
         self.df_buildings, sw, "uID", self.df_buildings["orient"]).series
     assert self.df_buildings["align_sw"][0] == pytest.approx(18.299481296)
     sw_drop = Queen.from_dataframe(self.df_tessellation[2:], ids="uID")
     assert (mm.Alignment(self.df_buildings, sw_drop, "uID",
                          self.df_buildings["orient"]).series.isna().any())
import momepy as mm
import geopandas as gpd
import libpysal

tess = gpd.read_file("files/elements.gpkg", layer="tessellation")
blg = gpd.read_file("files/elements.gpkg", layer="buildings")
blocks = gpd.read_file("files/elements.gpkg", layer="blocks")
streets = gpd.read_file("files/elements.gpkg", layer="streets")

blg["mtbSWR"] = mm.SharedWallsRatio(blg, "uID", "sdbPer").series

queen_1 = libpysal.weights.contiguity.Queen.from_dataframe(tess, ids="uID")

blg["mtbAli"] = mm.Alignment(blg, queen_1, "uID", "stbOri").series
blg["mtbNDi"] = mm.NeighbourDistance(blg, queen_1, "uID").series

tess["mtcWNe"] = mm.Neighbours(tess, queen_1, "uID", weighted=True).series
tess["mdcAre"] = mm.CoveredArea(tess, queen_1, "uID").series

str_q1 = libpysal.weights.contiguity.Queen.from_dataframe(streets)

streets["misRea"] = mm.Reached(streets,
                               tess,
                               "nID",
                               "nID",
                               spatial_weights=str_q1,
                               mode="count").series
streets["mdsAre"] = mm.Reached(streets,
                               tess,
                               "nID",
                               "nID",
Exemplo n.º 3
0
 def time_Alignment(self):
     mm.Alignment(self.df_buildings, self.sw, "uID",
                  self.df_buildings["orient"])
Exemplo n.º 4
0
 def test_Alignment(self):
     self.df_buildings["orient"] = mm.Orientation(self.df_buildings).series
     sw = Queen.from_dataframe(self.df_tessellation, ids="uID")
     self.df_buildings["align_sw"] = mm.Alignment(
         self.df_buildings, sw, "uID", self.df_buildings["orient"]).series
     assert self.df_buildings["align_sw"][0] == 18.299481296455237