Created
February 27, 2021 07:58
-
-
Save fish8/dfc0dcff71da3e1f4ec5d7a083e16f39 to your computer and use it in GitHub Desktop.
location2utm scala
This file contains 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
import scala.math.Integral.Implicits._ | |
def location2utm(location_id:Long):(Long,Long,Long) = { | |
// convert a location id to utm coordination | |
// THIS IS THE UTM VALUE AS IS IN SS OUTPUTS. TO GET CORRECTED UTM/LAT-LON USE sstool.ssutm.SSUtm | |
// return a tuple of (x, y, size) as left-bottom corner of a rectange | |
// if location_id < 100000000000: | |
// return None | |
val (size, coord) = location_id /% 1000000000000L | |
val (x, y) = coord /% 1000000L | |
((x - 400000)*125, (y - 80000) *125, (size %1000+1)*125) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment