(The documentation of function JapanMeshCode2latlonRange)
Last Update: 2021/11/30
◆機能・用途(Purpose)
日本の地域メッシュコードを与えてそのメッシュの緯度経度範囲を計算する。
Calculate the ranges of longitude and latitude
given the regional mesh code of Japan.
◆形式(Format)
#include <coordinate.h>
inline struct mesh_Japan JapanMeshCode2latlonRange(const int meshCode)
◆引数(Arguments)
meshCode
メッシュコード。
1次メッシュ(4桁)、2次メッシュ(6桁)、3次メッシュ(8桁)
のいずれであっても良い(桁数から判定される)。
The mesh code, which can be based either on
the 1st (4-digits), 2nd (6-digits), or 3rd (8-digits) meshes
as they can be distinguished by the number of digits.
◆戻り値(Return value)
引数meshCodeで与えたメッシュコードと対応する緯度経度範囲を格納した構造体。
A structure composed of the mesh code given by the argument meshCode
and the corresponding ranges of the longitude and latitude.
1次メッシュは緯度方向を40分間隔、経度方向を1度間隔で区分したメッシュである。
4桁の整数で表され、上位2桁はメッシュの南端の緯度の1.5倍、
下2桁はメッシュの西端の経度の下2桁を表す。
The 1st mesh is defined by 40-minute intervals in the latitude
and 1-degree intervals in the longitude.
It is expressed by a 4-digit integer,
where the upper 2 digits represent 1.5 times the latitude
of the southern edge of the mesh,
and the lower 2 digits represent those of the longitude
at the western edge of it.
例(Example):
1次メッシュコードの5236が表す座標範囲は以下のように計算できる。
The coordinate range for a 1st mesh code 5236 is calculated as follows.
上2桁(52)を1.5で割ると\(52/1.5=34+40/60\)であるので
南端は北緯34°40′である。
緯度方向のメッシュサイズは40分であるので北端は35°20′となる。
Dividing the upper 2 digits (52) by 1.5 gives \(52/1.5=34+40/60\),
meaning that the southern edge is
34°40′ in the north latitude.
Because the mesh size is 40 minutes along the latitude,
the northern edge is 35°20′.
下2桁が36であるので西端は東経136°である。
経度方向のメッシュサイズは1度であるので東端は東経137°となる。
The lower 2 digits (36) indicate that the western edge is
136° in the east longitude.
Because the mesh size is 1 degrees along the longitude,
the eastern edge is 137°.
2次メッシュは1次メッシュを東西・南北方向にそれぞれ8等分したもの
(緯度方向5分間隔、経度方向7.5分間隔)である。
6桁の整数で表され、上位4桁は1次メッシュコード、
5桁目は1次メッシュ内での緯度方向のサブメッシュ番号(0-7、北ほど大きい)、
6桁目は1次メッシュ内での経度方向のサブメッシュ番号(0-7、東ほど大きい)
を表す。
The 2nd mesh is defined by homogeneously dividing the 1st mesh
to 8×8 subsections along the EW and NS directions
(i.e., 5-minute intervals along the latitude
and 7.5-minute intervals along the longitude).
It is expressed by a 6-digit integer,
where the upper 4 digits represent the 1st mesh code,
the 5th digit points to the sub-mesh code within the 1st mesh
from 0 to 7 toward north,
and the 6th digit does toward east.
例(Example):
2次メッシュコードの523657が表す座標範囲は以下のように計算できる。
The coordinate range for a 2nd mesh code 523657
is calculated as follows.
上4桁が5236であるので、1次メッシュコードの5236が表す座標範囲
(北緯34°40′-35°20′、
東経136°-137°)
にある。
The upper 4 digits (5236) indicate that
the mesh is within the coordinate range
expressed by the 1st mesh code of 5236
(i.e., 34°40′-35°20′ in the north latitude
and 136°-137° in the east latitude).
5桁目が5であるので、上記の範囲を南北方向に8等分(5分刻み)した中の
南から数えて6番目の区画である。
これより北緯35°5′-35°10′であることが分かる。
The 5th digit (5) indicates that
the mesh is the 6th from the south
of the 8 equally divided subregions along NS (5-minute intervals)
of the 1st mesh region given above.
This means that the mesh spreads over
35°5′-35°10′ in the north latitude.
6桁目が7であるので、上記の範囲を東西方向に8等分(7.5分刻み)した中の
西から数えて8番目の区画である。
これより東経136°52′30"-137°であることが分かる。
The 6th digit (7) indicates that
the mesh is the 8th from the west
of the 8 equally divided subregions along EW (7.5-minute intervals)
of the 1st mesh region given above.
This means that the mesh spreads over
136°52′30"-137° in the east longitude.
3次メッシュは2次メッシュを東西・南北方向にそれぞれ10等分したもの
(緯度方向30秒間隔、経度方向45秒間隔)である。
8桁の整数で表され、上位6桁は2次メッシュコード、
7桁目は2次メッシュ内での緯度方向のサブメッシュ番号(0-9、北ほど大きい)、
8桁目は2次メッシュ内での経度方向のサブメッシュ番号(0-9、東ほど大きい)
を表す。
The 3rd mesh is defined by homogeneously dividing the 2nd mesh
to 10×10 subsections along the EW and NS directions
(i.e., 30-second intervals along the latitude
and 45-second intervals along the longitude).
It is expressed by a 8-digit integer,
where the upper 6 digits represent the 2nd mesh code,
the 7th digit points to the sub-mesh code within the 2nd mesh
from 0 to 9 toward north,
and the 8th digit does toward east.
例(Example):
3次メッシュコードの52365787が表す座標範囲は以下のように計算できる。
The coordinate range for a 3rd mesh code 52365787
is calculated as follows.
上6桁が523657であるので、2次メッシュコードの523657が表す座標範囲
(北緯35°5′-35°10′、
東経136°52′30"-137°)
にある。
The upper 6 digits (523657) indicate that
the mesh is within the coordinate range
expressed by the 2nd mesh code of 523657
(i.e., 35°5′-35°10′ in the north latitude
and 136°52′30"-137° in the east latitude).
7桁目が8であるので、上記の範囲を南北方向に10等分(30秒刻み)した中の
南から数えて9番目の区画である。
これより北緯35°9′-35°9′30"
であることが分かる。
The 7th digit (8) indicates that
the mesh is the 9th from the south
of the 10 equally divided subregions along NS (30-second intervals)
of the 2nd mesh region given above.
This means that the mesh spreads over
35°9′-35°9′30" in the north latitude.
8桁目が7であるので、上記の範囲を東西方向に10等分(45秒刻み)した中の
西から数えて8番目の区画である。
これより東経136°57′45"-136°58′30"
であることが分かる。
The 8th digit (7) indicates that
the mesh is the 8th from the west
of the 10 equally divided subregions along EW (45-second intervals)
of the 2nd mesh region given above.
This means that the mesh spreads over
136°57′45"-136°58′30"
in the east longitude.
◆検証(Validation)
メッシュコードとして5236, 523657, 52365787を与えた場合に
この関数を用いて計算される座標範囲が上記「補足」の例で手計算で得た値と
一致することを確認した。
It was confirmed that
the coordinate ranges for mesh codes 5236, 523657, and 52365787
calculated with this function were consistent with
the manually calculated values in the examples of
“Additional notes” above.