Created
September 6, 2019 07:21
-
-
Save danzig666/bda7c1449a2b3f1be2248e1477d9f9c0 to your computer and use it in GitHub Desktop.
QGIS - Calculate EOV section from EOV coordinates
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
leptek = ['M 1:100000','M 1:50000','M 1:25000','M 1:10000', 'M 1:4000','M 1:2000','M 1:1000','M 1:500','M 1:250'] | |
#1: 100000 #2: 50000 #3: 25000 #4: 10000 #5: 4000 #6: 2000 #7: 1000 #8: 500 #9: 250 | |
#leptek m: | |
m=6 | |
def eov_coord_to_szelveny(x,y): | |
#y=844116.87 #720750.0 #test coord | |
#x=246253.3 #278500.0 #test coord | |
dy = 48000.0 | |
dx = 32000.0 | |
print("Lépték: "+leptek[m-1]) | |
print("y: "+str(y)+" x:"+str(x)) | |
if (y < 384000.0 or y > 1008000 or x < 32000 or x > 384000): | |
print("Nem EOV koordináta! 384000 <= y <= 1008000 és 32000 <= x <= 384000") | |
raise Exception("Nem EOV koordináta! 384000 <= y <= 1008000 és 32000 <= x <= 384000") | |
sor = int((x - 32000.0) / dx) | |
oszlop = int((y - 384000.0) / dy) | |
y0 = oszlop * dy + 384000.0 | |
x0 = sor * dx + 32000.0 | |
sz = str(sor) + str(oszlop) + "-" | |
for i in range(1,m): | |
dx = dx/2.0 | |
dy = dy/2.0 | |
if len(sz) == 6: sz = sz + "-" | |
if len(sz) == 10: sz = sz + "-" | |
if (y <= y0 + dy and x > x0 + dx): | |
sz = sz+"1" | |
x0 = x0+dx | |
elif (y > y0 + dy and x > x0 + dx): | |
sz = sz+"2" | |
x0 = x0+dx | |
y0 = y0+dy | |
elif (y <= y0 + dy and x <= x0 + dx): | |
sz = sz+"3" | |
elif (y > y0 + dy and x <= x0 + dx): | |
sz = sz+"4" | |
y0 = y0+dy | |
print(sz) | |
return sz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment