Commit 06cdb625 authored by Lukas Eller's avatar Lukas Eller

changed name to plot_locations_osm

parent 3af62942
from .data_extractor import (
fetch_rtr_details,
fetch_rtr_details,
fetch_rtr_overview
)
from .geospatial import (
......@@ -14,7 +14,7 @@ from .geospatial import (
pull_from_geodatenviewer_meas
)
from .plotting import (
plot_series_osm,
plot_locations_osm,
plot_street_nodes
)
from .preprocess import (
......
......@@ -36,7 +36,7 @@ def get_geoseries_streets(
"""
Obtain the street shapes in the area spanned by the measurement_coords.
:param measurement_coords: A geopandas geoseries of Points(lon, lat) representing the measurement positions in a e:4326 projection
:param measurement_coords: A geopandas geoseries of Points(lon, lat) representing the measurement positions in a EPSG:4326 projection
:param retries: Number of retries for overpy requests, default:5
:param crop: Set to True if the returned geoseries should be fixed to bounding box determined by measurement_coords, default: False
......@@ -362,7 +362,7 @@ def pull_from_geodatenviewer_list(squares: List[str]) -> gpd.GeoDataFrame:
def pull_from_geodatenviewer_meas(measurement_coords: gpd.GeoSeries) -> gpd.GeoDataFrame:
'''
Downloads raster .zip file for Vienna Austria, extracts all raster polygon IDs containing measurements,
Downloads raster .zip file for Vienna Austria, extracts all raster polygon IDs containing measurements,
then calls pull_from_geodatenviewer_list() to extract building polygons.
:param measurement_coords: geopandas geoseries containing measurements in EPSG:4326 projection
......@@ -378,7 +378,7 @@ def pull_from_geodatenviewer_meas(measurement_coords: gpd.GeoSeries) -> gpd.GeoD
"https://data.wien.gv.at/daten/geo?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:MZKBLATT1000OGD&srsName=EPSG:4326&outputFormat=shape-zip",
os.path.join(raster_path, "raster.zip"),
)
file_name = os.path.join(raster_path, "raster.zip")
zip_ref = zipfile.ZipFile(file_name) # create zipfile object
zip_ref.extractall(raster_path) # extract file to dir
......@@ -399,5 +399,3 @@ def pull_from_geodatenviewer_meas(measurement_coords: gpd.GeoSeries) -> gpd.GeoD
return_gdf = pull_from_geodatenviewer_list(polygonID_list)
return return_gdf
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
import numpy as np
from typing import Tuple
def plot_series_osm(
def plot_locations_osm(
gps_series: gpd.GeoSeries,
c_series: np.ndarray = None,
zoom_level: int = 10,
......@@ -26,7 +26,7 @@ def plot_series_osm(
:param **kwargs: additional keword arguements which will directly be passed on to scatterplot
:param save_path: if not none then the plot will be saved under this path
"""
if gps_series.crs != "EPSG:4326":
raise ValueError("Make sure to pass data with EPSG:4326 projection")
......
......@@ -20,22 +20,22 @@ class TestPlottingOSM(unittest.TestCase):
def test_basic(self):
#Check if no exception comes up
series = self._gps_series.set_crs("EPSG:4326")
mpc.plotting.plot_series_osm(series, show=False)
mpc.plotting.plot_locations_osm(series, show=False)
def test_exception_epsg(self):
with self.assertRaises(ValueError):
series = self._gps_series#.set_crs("EPSG:4326")
mpc.plotting.plot_series_osm(series, show=False)
mpc.plotting.plot_locations_osm(series, show=False)
def test_kwargs_basic(self):
series = self._gps_series.set_crs("EPSG:4326")
mpc.plotting.plot_series_osm(series, show=False, color="red")
mpc.plotting.plot_locations_osm(series, show=False, color="red")
def test_kwargs_double(self):
#s is based twice here
with self.assertRaises(TypeError):
series = self._gps_series.set_crs("EPSG:4326")
mpc.plotting.plot_series_osm(series, show=False, s=100, color="red")
mpc.plotting.plot_locations_osm(series, show=False, s=100, color="red")
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment