Example #1
0
import momepy as mm
import geopandas as gpd
import libpysal
import numpy as np
from tqdm import tqdm
import pandas as pd

# In[5]:

mm.__version__, gpd.__version__, libpysal.__version__, np.__version__, pd.__version__

# In[ ]:

buildings = gpd.read_file('data/zurich.gpkg', layer='buildings')

buildings = mm.preprocess(buildings, size=30, compactness=False, islands=True)

buildings['uID'] = range(len(buildings))

buildings['blg_area'] = buildings.area
buildings.to_file('data/zurich.gpkg', layer='buildings', driver='GPKG')

buildings['geometry'] = buildings.simplify(0.2)
print('simplified')

buffers = [300, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200]
for buf in buffers:
    print('Generating', buf)
    limit = mm.buffered_limit(buildings, buf)
    tessellation = mm.Tessellation(buildings, 'uID', limit).tessellation
    tessellation.to_file('data/tessellation/{0}_tessellation.shp'.format(buf))
Example #2
0
 def time_preprocess(self):
     mm.preprocess(self.os_buildings)
Example #3
0
 def test_preprocess(self):
     test_file_path2 = mm.datasets.get_path('tests')
     self.os_buildings = gpd.read_file(test_file_path2, layer='os')
     processed = mm.preprocess(self.os_buildings)
     assert len(processed) == 5