mbari-org / SeafloorMappingDB

Make MBARI seafloor mapping datasets more accessible and useful
GNU General Public License v3.0
3 stars 6 forks source link

Add nav_track_length field to Mission table #146

Closed MBARIMike closed 2 years ago

MBARIMike commented 2 years ago

Per a request to have simple to generate reports of distance traversed by seafloor surveys add a nav_track_length field to the Mission table and calculate the length in meters during the load using a method similar to what's outlined here:

https://gis.stackexchange.com/a/181251/62207

MBARIMike commented 2 years ago

Jupyter Notebook that adds up all the MBARI Mission track_lengths:

https://github.com/mbari-org/SeafloorMappingDB/blob/main/smdb/notebooks/1.0-mpm-track_lengths.ipynb

MBARIMike commented 2 years ago

It turns out that this simplistic method of computing length:

        # Convert to web mercator and get length in km
        # https://gis.stackexchange.com/a/181251/62207
        nav_track_wm = nav_track
        nav_track_wm.transform(3857)
        track_length = round(nav_track_wm.length / 1000.0, 4)

works only at the equator and will give erroneously large values away from the equator, hence the PR above.

MBARIMike commented 2 years ago

The track length metadata is available via the .inf files in the Mission directories. https://github.com/mbari-org/SeafloorMappingDB/pull/164 adds up these track lengths and compares them to the one computed with haversine() on the simplified LineString geometry. We'd expect the latter to be slightly less than former as the simplify() process removes wide turns and jaggies in the actual track. In fact, the haversine() computed track length is generally around 97% of the .inf file summed track lengths. This special log file has all the details: https://901101-smdb-media.s3.amazonaws.com/media/logs/dist_sums.txt

MBARIMike commented 2 years ago

Changing haversine() to .inf file values increased slightly the total track_length in the Notebook from 26672.7 to 27079.9.

MBARIMike commented 2 years ago

Closing this.