Friday 30 March 2018

python - PyProj - Transform coordinate in "HK80 grid" to "WGS 84 / UTM zone 49N or 49S"


Am trying to use python pyproj to do the above conversion (convert/transform from Hong Kong GRID to Hong Kong UTM), but am getting different values from the expected result.


My expected conversion result is: "North 836148, East 822745" to "North 828672.7449, East 12488562.2742". See my codes below for both zones (N and S):-


# https://epsg.io/102141

inProj = Proj(init='epsg:2326') # PCS: Hong_Kong_1980_Grid or EPSG:102140
outProj = Proj("+proj=utm +zone=49 +ellps=intl +units=m +no_defs") # PCS: Hong_Kong_1980_UTM_Zone_49N or EPSG:102141
# outPro = Proj(init='epsg:102141') # This returns RuntimeError

# Expected result: 828672.7449, 12488562.2742


x1, y1 = 822745, 836148
# x1, y1 = 836148, 822745


x2, y2 = transform(inProj, outProj, x1, y1)
print (x2, y2)

Or


# https://epsg.io/32749


inProj = Proj(init='epsg:2326') # PCS: Hong_Kong_1980_Grid or epsg:102140
# outProj = Proj("+proj=utm +zone=49 +south +datum=WGS84 +units=m +no_defs") # PCS: Hong_Kong_1980_UTM_Zone_49S or EPSG:32749
outProj = Proj(init='epsg:32749')

# Expected result: 828672.7449, 12488562.2742

x1, y1 = 822745, 836148
# x1, y1 = 836148, 822745



x2, y2 = transform(inProj, outProj, x1, y1)
print (x2, y2)

Could it be that my expected result is incorrect or I am missing something? I want to certisfy the expected output by going from: "Hong_Kong_1980_Grid_System" to "Hong_Kong_1980_UTM_Zone_49N / 49S"?


North   East    North1      East1
836148 822745 828672.7449 12488562.27
831905 822495 827480.7854 12473200.37
838208 816918 810095.1039 12481647.01
838127 816314 805922.5972 12482194.51

837452 820146 815300.3898 12484301.71
833764 816330 808333.7182 12478896.42
841476 830964 834944.8892 12495195.37

The result needs to match above table from Hong Kong 1980 grid to WGS84/UTM 49S




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...