Skip to content

Commit

Permalink
fix error for not providing background map
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-urban committed Jul 31, 2024
1 parent e49d001 commit 8c7dea0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions python/tests/overview/test_navplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ def test_create_figure_background_image_projection(self):
src_utm = os.path.join(os.path.dirname(__file__), src_utm)
src_latlon = os.path.join(os.path.dirname(__file__), src_latlon)

# make sure this does not crash with no figure provided
_,_,crs = Ping.pingprocessing.overview.nav_plot.create_figure('nav', return_crs=True)
_,_ = Ping.pingprocessing.overview.nav_plot.create_figure('nav', return_crs=False)
_,_,crs = Ping.pingprocessing.overview.nav_plot.create_figure('nav', return_crs=True, dst_crs = None)
_,_ = Ping.pingprocessing.overview.nav_plot.create_figure('nav', return_crs=False, dst_crs = None)

# default projection should be EPSG:4326
_,_,crs = Ping.pingprocessing.overview.nav_plot.create_figure('nav', background_image_path=src_latlon, return_crs=True)
assert crs == rio.crs.CRS.from_epsg(4326)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def create_figure(
rioplt.show(reprojected_map, ax=ax, **_kwargs)
dst_crs = reprojected_map.crs

if dst_crs.is_geographic:
ax.set_xlabel("longitude")
ax.set_ylabel("latitude")
elif dst_crs.is_projected:
ax.set_xlabel("easting")
ax.set_ylabel("northing")
if dst_crs.is_geographic:
ax.set_xlabel("longitude")
ax.set_ylabel("latitude")
elif dst_crs.is_projected:
ax.set_xlabel("easting")
ax.set_ylabel("northing")

if return_crs:
return fig, ax, dst_crs
Expand Down

0 comments on commit 8c7dea0

Please sign in to comment.