Last active
July 15, 2017 05:59
-
-
Save ymattu/1786ba32fb5597092498556e093dd5be to your computer and use it in GitHub Desktop.
緯度経度から標準地域メッシュコードを算出
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
libname sasfunc "X:\sastest" ; | |
proc fcmp outlib=sasfunc.functions.geo ; | |
function latlong2mesh(lat, long) ; | |
/* latitude */ | |
lat_in_min = lat * 60 ; | |
code12 = int(lat_in_min / 40) ; | |
lat_rest_in_min = lat_in_min - code12 * 40 ; | |
code5 = int(lat_rest_in_min / 5 ) ; | |
lat_rest_in_min = lat_rest_in_min - code5 * 5 ; | |
code7 = int(lat_rest_in_min / (5 / 10)) ; | |
/* longitude */ | |
code34 = int(long) - 100 ; | |
long_rest_in_deg = long - int(long) ; | |
code6 = int(long_rest_in_deg * 8) ; | |
long_rest_in_deg = long_rest_in_deg - code6 / 8 ; | |
code8 = int(long_rest_in_deg / (1 / 80) ) ; | |
/* meshcode */ | |
code12 = put(code12, best12.) ; | |
code34 = put(code34, best12.) ; | |
code5 = put(code5, best12.) ; | |
code6 = put(code6, best12.) ; | |
code7 = put(code7, best12.) ; | |
code8 = put(code8, best12.) ; | |
mesh3 = input(compress(cat(code12, code34, code5, code6, code7, code8)), best12.) ; | |
/* return */ | |
return(mesh3) ; | |
endsub ; | |
run ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment