From 66a1ca8b24583006e08fcf50170ef4e82cf6a939 Mon Sep 17 00:00:00 2001 From: hkoertge Date: Fri, 29 Sep 2023 09:10:45 +0200 Subject: [PATCH 1/2] fixes #2138 fixed create_test_network fixed issue in geo.py resulting from #2138 --- pandapower/plotting/geo.py | 2 +- pandapower/test/helper_functions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandapower/plotting/geo.py b/pandapower/plotting/geo.py index 8fac835a9..e28fdf734 100644 --- a/pandapower/plotting/geo.py +++ b/pandapower/plotting/geo.py @@ -319,7 +319,7 @@ def dump_to_geojson(net, nodes=False, branches=False): coords.append(net.pipe_geodata.loc[uid].coords) coords.append([float(to_coords.x), float(to_coords.y)]) - geom = geojson.LineString(row.coords.tolist() if is_pandapower else coords) + geom = geojson.LineString(row.coords if is_pandapower else coords) features.append(geojson.Feature(geometry=geom, id=uid, properties=props[uid])) # find and set crs if available crs_node = None diff --git a/pandapower/test/helper_functions.py b/pandapower/test/helper_functions.py index bbb930b10..b6eb45269 100644 --- a/pandapower/test/helper_functions.py +++ b/pandapower/test/helper_functions.py @@ -53,7 +53,7 @@ def create_test_network(): pp.create_line_from_parameters(net, b2, b3, 1, name="line1", r_ohm_per_km=0.2067, ices=0.389985, c_nf_per_km=720.0, max_i_ka=0.328, - x_ohm_per_km=0.1897522, geodata=np.array([[1, 2], [3, 4]])) + x_ohm_per_km=0.1897522, geodata=[[1, 2], [3, 4]]) # NAYY 1x150RM 0.6/1kV ir pp.create_line_from_parameters(net, b1, b4, 1, name="line2", r_ohm_per_km=0.876, c_nf_per_km=260.0, max_i_ka=0.123, x_ohm_per_km=0.1159876) From e97cd429699ce91f7f09743eea9ceef0ae00638b Mon Sep 17 00:00:00 2001 From: hkoertge Date: Fri, 29 Sep 2023 09:30:55 +0200 Subject: [PATCH 2/2] updated deprecated call in geo.py --- pandapower/plotting/geo.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pandapower/plotting/geo.py b/pandapower/plotting/geo.py index e28fdf734..3b0e6b8f3 100644 --- a/pandapower/plotting/geo.py +++ b/pandapower/plotting/geo.py @@ -23,7 +23,7 @@ geopandas_INSTALLED = False try: - from pyproj import Proj, transform, Transformer + from pyproj import Transformer pyproj_INSTALLED = True except ImportError: @@ -106,9 +106,8 @@ def _convert_xy_epsg(x, y, epsg_in=4326, epsg_out=31467): """ if not pyproj_INSTALLED: soft_dependency_error(str(sys._getframe().f_code.co_name)+"()", "pyproj") - in_proj = Proj(init='epsg:%i' % epsg_in) - out_proj = Proj(init='epsg:%i' % epsg_out) - return transform(in_proj, out_proj, x, y) + transformer = Transformer.from_crs(f'EPSG:{epsg_in}', f'EPSG:{epsg_out}', always_xy=True) + return transformer.transform(x, y) def convert_gis_to_geodata(net, node_geodata=True, branch_geodata=True):