Add coordinate reference system (CRS) support to acoustic localization#1263
Open
martinguthrie93 wants to merge 1 commit into
Open
Add coordinate reference system (CRS) support to acoustic localization#1263martinguthrie93 wants to merge 1 commit into
martinguthrie93 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional coordinate reference system (CRS) support to the localization module,
so users can work directly with geographic coordinates (longitude/latitude) instead of
manually projecting to meters. Closes #1262.
What changed
opensoundscape/localization/coordinates.pywithpyproj-backed helpers:utm_epsg_for_lonlat,lonlat_to_xy,xy_to_lonlat,project_file_coords.SynchronizedRecorderArray: newfrom_lonlat()classmethod that projects lon/latreceiver coordinates to a metric CRS (auto-selects the UTM zone), plus a
crsattribute propagated to each returned
PositionEstimate.PositionEstimate: newcrsfield andlocation_estimate_lonlatproperty thatconverts the estimated location back to longitude/latitude.
pyprojadded as an optional dependency +localizationextra(
pip install opensoundscape[localization]). Core install is unaffected.Why
Field recorders log positions as lon/lat (WGS84), but localization requires Cartesian
meters. Previously users had to manually pick a UTM zone and convert coordinates by
hand (error-prone). This makes the lon/lat → localization → mapped-result path direct.
Testing
tests/test_coordinates.py(12 tests): round-trip conversion, UTM zoneselection (N/S hemisphere),
from_lonlat,location_estimate_lonlat, dictround-trip. Skipped automatically if
pyprojis not installed.blackformatting applied.