diff --git a/city_metrix/layers/open_street_map.py b/city_metrix/layers/open_street_map.py index 45f0900..a4e5489 100644 --- a/city_metrix/layers/open_street_map.py +++ b/city_metrix/layers/open_street_map.py @@ -3,7 +3,7 @@ import geopandas as gpd import pandas as pd -from .layer import Layer +from .layer import Layer, get_utm_zone_epsg class OpenStreetMapClass(Enum): @@ -71,4 +71,7 @@ def get_data(self, bbox): keep_col.append('lanes') osm_feature = osm_feature.reset_index()[keep_col] + crs = get_utm_zone_epsg(bbox) + osm_feature = osm_feature.to_crs(crs) + return osm_feature diff --git a/city_metrix/layers/overture_buildings.py b/city_metrix/layers/overture_buildings.py index f8b2e24..82b9d28 100644 --- a/city_metrix/layers/overture_buildings.py +++ b/city_metrix/layers/overture_buildings.py @@ -2,7 +2,7 @@ import subprocess from io import StringIO -from .layer import Layer +from .layer import Layer, get_utm_zone_epsg class OvertureBuildings(Layer): @@ -24,6 +24,8 @@ def get_data(self, bbox): if result.returncode == 0: geojson_data = result.stdout overture_buildings = gpd.read_file(StringIO(geojson_data)) + crs = get_utm_zone_epsg(bbox) + overture_buildings = overture_buildings.to_crs(crs) else: print("Error occurred:", result.stderr) diff --git a/city_metrix/layers/smart_surface_lulc.py b/city_metrix/layers/smart_surface_lulc.py index ab1abee..e4759a6 100644 --- a/city_metrix/layers/smart_surface_lulc.py +++ b/city_metrix/layers/smart_surface_lulc.py @@ -60,17 +60,17 @@ def get_data_esa_reclass(esa_world_cover): # Open space - open_space_osm = OpenStreetMap(osm_class=OpenStreetMapClass.OPEN_SPACE_HEAT).get_data(bbox).to_crs(crs).reset_index() + open_space_osm = OpenStreetMap(osm_class=OpenStreetMapClass.OPEN_SPACE_HEAT).get_data(bbox).reset_index() open_space_osm['Value'] = 10 # Water - water_osm = OpenStreetMap(osm_class=OpenStreetMapClass.WATER).get_data(bbox).to_crs(crs).reset_index() + water_osm = OpenStreetMap(osm_class=OpenStreetMapClass.WATER).get_data(bbox).reset_index() water_osm['Value'] = 20 # Roads - roads_osm = OpenStreetMap(osm_class=OpenStreetMapClass.ROAD).get_data(bbox).to_crs(crs).reset_index() + roads_osm = OpenStreetMap(osm_class=OpenStreetMapClass.ROAD).get_data(bbox).reset_index() if len(roads_osm) > 0: roads_osm['lanes'] = pd.to_numeric(roads_osm['lanes'], errors='coerce') # Get the average number of lanes per highway class @@ -130,7 +130,7 @@ def get_data_esa_reclass(esa_world_cover): ) # get building features - buildings = OvertureBuildings().get_data(bbox).to_crs(crs) + buildings = OvertureBuildings().get_data(bbox) # extract ULU, ANBH, and Area_m buildings['ULU'] = exact_extract(ulu_lulc_1m, buildings, ["majority"], output='pandas')['majority'] buildings['ANBH'] = exact_extract(anbh_1m, buildings, ["mean"], output='pandas')['mean'] @@ -181,7 +181,7 @@ def classify_building(building): # Parking - parking_osm = OpenStreetMap(osm_class=OpenStreetMapClass.PARKING).get_data(bbox).to_crs(crs).reset_index() + parking_osm = OpenStreetMap(osm_class=OpenStreetMapClass.PARKING).get_data(bbox).reset_index() parking_osm['Value'] = 50