-
-
Save snuxoll/79137 to your computer and use it in GitHub Desktop.
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
# | |
# Return UTM Zone for a geom | |
# | |
# Return Integer | |
def utm_zone | |
geomgeog = srid == 4326 ? self[get_column_name] : transform(4326) | |
puts geomgeog.class | |
geom = case geomgeog | |
when Point then geomgeog | |
when LineString then geomgeog.first | |
else | |
geomgeog.first.first | |
end | |
pref = geom.y > 0 ? 32700 : 32600 | |
zone = ((geom.x + 180) / 6 + 1).to_i | |
zone + pref | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment