Last active
September 29, 2018 21:28
-
-
Save jaakla/5a420d3d0527747291f8636846bda077 to your computer and use it in GitHub Desktop.
Eesti Põhikaardi 1:10000 grid numbri arvutus
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
# src: https://geoportaal.maaamet.ee/est/Andmed-ja-kaardid/Koordinaatsusteemid-ja-kaardilehtede-jaotused/Kaardilehtede-susteemid-p224.html | |
# consts for bounds | |
xmin = 300000 | |
xmax = 800000 | |
square_x = 100000 # 1st level grid size | |
ymin = 6300000 | |
ymax = 6700000 | |
square_y = 100000 | |
start1 = 4 # grid digit offsets | |
start2 = 1 | |
start5 = 1 | |
# input data, center of 53833 square | |
x = 532500 | |
y = 6487500 | |
xrel = x - xmin | |
yrel = y - ymin | |
grid10t = str((yrel//square_y) + start1) \ | |
+ str((xrel//square_x) + start2) \ | |
+ str(((yrel % square_y)//10000)) \ | |
+ str(((xrel % square_x)//10000)) \ | |
+ str(2 * ((yrel % square_y)//80000) + ((xrel % square_x)//80000) + start5) | |
print(grid10t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment