TL;DR
https://github.com/MIERUNE/japan-mesh-tool
--The Python module that generates the Japanese standard region mesh has been released as OSS. --Can generate meshes of commonly used units up to 50m --Including the experimentally created Rust version
The area mesh (chiiki mesh) is a mesh that divides the area into meshes of almost the same size based on latitude and longitude for use in statistics. The code for identifying the mesh is called the regional mesh code. [Regional Mesh-Wikipedia](https://ja.wikipedia.org/wiki/%E5%9C%B0%E5%9F%9F%E3%83%A1%E3%83%83%E3%82%B7% E3% 83% A5)
――It seems that there is no OSS that can generate a regional mesh up to 50m and can be used easily. ――There are many cases where a regional mesh is needed on various occasions, and it seems that various people are developing it each time.
japan-mesh-tool https://github.com/MIERUNE/japan-mesh-tool It will be distributed under the MIT license.
--Developed with Python 3.8 (I think it will work for 3 series) --Uses only standard modules (no dependencies)
(1) Mesh order (2) Output mesh data in geojsonl format from the area (latitude and longitude). geojsonl format: A text file in which geojson is separated by feature, also called GeoJSON Seq.
Degree | Also known as | Details | Mesh code |
---|---|---|---|
1 | - | 80km mesh | 4 digits |
2 | - | 10km mesh | 6 digits |
3 | - | 1km mesh | 8-digit |
4 | 500 | 500m mesh | 10 digits |
5 | 250 | 250m mesh | 12 digits |
6 | 125 | 125m mesh | 14 digits |
7 | 50 | 50m mesh | 14 digits |
python python/japanmesh/main.py <meshnum:Mesh order> <-e:Area designation,"Comma-separated latitude and longitude Comma-separated latitude and longitude"Specify in format> <-d:Destination>
python python/japanmesh/main.py 5 -e 142.2,44.0 142.3,44.5 -d ./
4th mesh and above can be specified by another name
python python/japanmesh/main.py 250 -e 142.2,44.0 142.3,44.5 -d ./
The area and save destination can be omitted. In that case, the primary mesh for the whole country is output to the current directory.
python python/japanmesh/main.py 1
Since the total number of meshes is huge for 3rd order meshes and above, it takes time to process if a large area is specified.
I wrote the same process in Rust on a trial basis to improve the processing speed. rust / japanmesh is a compiled binary (rust / japanmesh.exe for Windows).
rust/japanmesh <meshnum:Mesh order> <Area specification(Optional)>
Always output the geojsonl file to the current directory.
macOS(64bit)
rust/japanmesh 5 142.2,44.0 142.3,44.5
Or omit the area
rust/japanmesh 3
--./python/japanmesh itself can be imported as a Python module --In that case, you can only use the get_meshes () function (See ./python/sample.py for usage examples)
Red: 3rd, White: 4th (3rd is divided into 4)
Blue: 5th order, Black: 7th order (5th order is divided into 25)
--3 Follow https://www.stat.go.jp/data/mesh/pdf/gaiyo1.pdf until the next --From the 4th onward, add 2 digits to the end of the upper mesh code based on the following rules (as shown in the image above). --Set the lower left to 00 ――If you go up one, it will be 10, if you go two, it will be 20 ... --If you go one to the right, it will be 01, if you go two, it will be 02 ...
Recommended Posts