lem ファイルを GeoTIFF に変換するスクリプトです。
- lem ファイル仕様
- https://www.gsi.go.jp/MAP/CD-ROM/dem5m/doc/info5m1.htm
- ただし、データ間隔によりレコード数等は説明と合致しないことがあります。
| #!/usr/bin/python | |
| """ | |
| 1,-42000.75,108723.75,132.60,0 | |
| 2,-42000.25,108723.75,132.30,0 | |
| 3,-42001.75,108723.25,132.80,0 | |
| : | |
| : | |
| という形式の CSV ファイルを | |
| -42000.750 108723.750 132.600 |
| # -*- coding: utf-8 -*- | |
| import math | |
| from qgis.PyQt.QtCore import (QCoreApplication, QVariant) | |
| from qgis.core import (QgsPointXY, QgsGeometry, QgsFeature, | |
| QgsField, QgsFields, QgsWkbTypes, QgsProject, QgsUnitTypes, | |
| QgsCoordinateReferenceSystem, QgsCoordinateTransform) | |
| from qgis.core import (QgsProcessing, | |
| QgsFeatureSink, |
| # -*- coding: utf-8 -*- | |
| """ | |
| *************************************************************************** | |
| * * | |
| * This program is free software; you can redistribute it and/or modify * | |
| * it under the terms of the GNU General Public License as published by * | |
| * the Free Software Foundation; either version 2 of the License, or * | |
| * (at your option) any later version. * | |
| * * |
lem ファイルを GeoTIFF に変換するスクリプトです。
| # 図郭コードから [xmin, ymin, xmax, ymax] を求める | |
| # 図郭コードは平面直角座標系の系を除外したコードとする | |
| # 例) 09LD352 → LD352 | |
| def zukaku(code, output_wkt=false) | |
| level = nil | |
| if code =~ /^[A-T][A-H]$/ | |
| level = 50000 | |
| elsif code =~ /^[A-T][A-H]\d\d$/ | |
| level = 5000 | |
| elsif code =~ /^[A-T][A-H]\d\d[1-4]$/ |
| #!/usr/bin/ruby | |
| class NumberPlace | |
| def initialize(ary=nil) | |
| init(ary) | |
| end | |
| def init(ary=nil) | |
| @cells = Array.new(81) do | |
| [1, 2, 3, 4, 5, 6, 7, 8, 9] |
| { | |
| "common_fields" : [ | |
| ["gml_id", "String"], | |
| ["fid", "String"], | |
| ["lfSpanFr", "Date"], | |
| ["lfSpanTo", "Date"], | |
| ["devDate", "Date"], | |
| ["orgGILvl", "String"], | |
| ["orgMDId", "String"], | |
| ["vis", "String"] |
| from qgis.core import * | |
| from qgis.gui import * | |
| """ | |
| 使い方: | |
| getFeatureAttribute(対象レイヤID, 空間関係, 取得したい属性名) | |
| 例: | |
| getFeatureAttribute('ポリゴンレイヤ_7dff1692_ba18_4bd1_bf46_63785338b050' , 'intersects', 'name') |
| #!/usr/bin/ruby | |
| def read_data(io, type, bo, label = '') | |
| data = nil | |
| bytes = nil | |
| value = nil | |
| if type == :int | |
| data = io.read(4) |