At the memorandum level, I created a function to convert 3rd order mesh code to WKT with python. It's sober, but it's easy to lose track of when you need it ...
def toWKTfromMeshCode3(mcode3: 'mesh code(str)'):-> 'wkt(str)'
south = (int(mcode3[0:2]) * 80 + int(mcode3[4:5]) * 10 + (int(mcode3[6:7]))) * 30 / 3600
west = (int(mcode3[2:4]) * 80 + int(mcode3[5:6]) * 10 + (int(mcode3[7:8]))) * 45 / 3600 + 100
north = south + 30 / 3600
east = west + 45 / 3600
wkt = 'POLYGON(({e} {n},{w} {n},{w} {s},{e} {s},{e} {n}))'.format(s=south, w=west, n=north, e=east)
return wkt
Recommended Posts