jmerkle1 / Migration-Mapper

Repository for Migration Mapper
MIT License
6 stars 0 forks source link

Migration distances not in KM with a lat/long dataset #18

Closed jmerkle1 closed 1 month ago

jmerkle1 commented 2 months ago

When a dataset is in lat/long, the migration distances calculated in app 4 (i.e., the CalcSeqDistances.R function) are not calculated in KM, they are in decimal degrees. Need to add a line in CalcSeqDistances.R function to note if the sequences are in lat/long, and if so, transform into UTM before calculating the distances.

gagecarto commented 2 months ago

Hey @jmerkle1 - I am looking into this now. When sequences are written as RDS files, they're always converted to 4326 firstbefore being saved. I think we could solve this by converting to the UTM before writing files.

I am not sure why I chose to write to 4326 before saving. Do you see any downstream issues with the RDS sequences if they're in UTM instead of decimal degrees?

https://github.com/jmerkle1/Migration-Mapper/blob/dc32cf3618c079057d067783cf9c8bbf3592dcb5/app3_sequenceWriting/scripts/app3_calcSequences.R#L68

jmerkle1 commented 2 months ago

I like writing the rds files out in either 4326 OR the projection of the data that the user supplied in the first place (I think when we write out shapefiles it is written out in the projection originally supplied?). It is just for the calculation of the migration distances that we should we transform into a projection with meters as the units.

gagecarto commented 2 months ago

It probably makes sense to convert the RDS sequences to UTM. The sequence RDS files are used to calculate distances but are also fed into the cluster when calculating UDs. I just want to make sure it won't cause issues when we're calculating UDs

gagecarto commented 1 month ago

Sequences are now calculated in UTM. You can pull down a new copy and see. I can now see reasonable values in the ...migration_distance_info.csv files.