Skip to content

Instantly share code, notes, and snippets.

#!/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,
@tohka
tohka / check_widget.py
Created November 3, 2020 03:35
QGIS の QgsProcessingParameter* がどのようなインタフェースで表示されるか確認するやつ
# -*- 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. *
* *
@tohka
tohka / README.md
Last active March 12, 2025 11:54
lem ファイルを GeoTIFF に変換するスクリプト

lem2gtif.py

概要

lem ファイルを GeoTIFF に変換するスクリプトです。

使い方

@tohka
tohka / zukaku.rb
Created June 24, 2020 15:51
図郭コードから座標値を取得する
# 図郭コードから [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]
@tohka
tohka / layer_spec.json
Last active May 13, 2020 04:49
基盤地図情報の PackDLMap.zip を全ファイル展開し、種別ごとにマージするやつ
{
"common_fields" : [
["gml_id", "String"],
["fid", "String"],
["lfSpanFr", "Date"],
["lfSpanTo", "Date"],
["devDate", "Date"],
["orgGILvl", "String"],
["orgMDId", "String"],
["vis", "String"]
@tohka
tohka / getFeatureAttribute.py
Last active February 2, 2020 13:22
getFeatureAttribute
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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.