Skip to content

Instantly share code, notes, and snippets.

@yoichigmf
Last active December 6, 2015 08:40
Show Gist options
  • Save yoichigmf/712e4e542fdf8e66b186 to your computer and use it in GitHub Desktop.
Save yoichigmf/712e4e542fdf8e66b186 to your computer and use it in GitHub Desktop.

Revisions

  1. yoichigmf revised this gist Dec 6, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions kanto.pl
    Original file line number Diff line number Diff line change
    @@ -32,8 +32,8 @@

    $dcode = substr( $_, 7+($i*2), 2 ); #

    $xp = ($yorg * 1000) + ($i * 10 ); # デカルト座標系 X座標 m単位
    $yp = ($xorg* 1000) - ($linenum * 10 ); # デカルト座標系 Y座標 m単位
    $xp = ($yorg * 1000) + ($i * 10 ); # デカルト座標系 X座標 m単位 もしかすると ここは -5 が必要かも
    $yp = ($xorg* 1000) - ($linenum * 10 ); # デカルト座標系 Y座標 m単位        こちらは +5 ね

    print "${xp},${yp},${dcode}\n"; # デカルト座標系 x,y,value を出力

  2. yoichigmf created this gist Dec 6, 2015.
    46 changes: 46 additions & 0 deletions kanto.pl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    #!/usr/local/bin/perl
    #
    #
    # 細密数値情報 asc 変換 首都圏版
    #
    #
    # 利用方法
    # Unix Linux 系 cat <tdu file name> | perl kanto.pl > <output asc file name>
    # Win系 type <tdu file name> | perl kanto.pl > <output asc file name>
    #
    # 利用例 type s5_2010.tdu | perl kanto.pl > s5_2010.asc
    #
    # 細密数値情報 首都圏のファイルを x,y,z 形式の ascii ファイル(asc ファイル)に変換する。
    # ただし 首都圏データのみ対応   (近畿圏、中部圏はたぶん原点座標が異なる)
    # http://www1.gsi.go.jp/geowww/LandUse/saimitsudr.html
    # http://www.gdal.org/frmt_xyz.html
    #
    # 2015.12.6 Yoichi.Kayama yoichi.kayama@gmail.com
    #

    # 行単位ループ
    while(<>) {

    $filecode = substr( $_, 0, 4 ); # ファイルコード
    $linenum = substr( $_, 4, 3 ); # 行番号


    $xorg =-1 * ( substr($filecode, 0, 2 ) * 3 - 30 ); # 左上原点 X座標(測量の) 平面直角座標9系 Km単位
    $yorg = substr( $filecode, 2, 2 ) * 4 -80; # 左上原点 y座標(測量の) 平面直角座標9系 Km単位  

    for ( $i=0; $i < 400; ++$i ) { # デカルト座標系 X方向 カラム値の取得 400個

    $dcode = substr( $_, 7+($i*2), 2 ); #

    $xp = ($yorg * 1000) + ($i * 10 ); # デカルト座標系 X座標 m単位
    $yp = ($xorg* 1000) - ($linenum * 10 ); # デカルト座標系 Y座標 m単位

    print "${xp},${yp},${dcode}\n"; # デカルト座標系 x,y,value を出力

    }





    }
    35 changes: 35 additions & 0 deletions tochiriyou.qml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    <!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
    <qgis version="2.12.0-Lyon" minimumScale="0" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">
    <pipe>
    <rasterrenderer opacity="1" alphaBand="-1" classificationMax="19" classificationMinMaxOrigin="User" band="1" classificationMin="0" type="singlebandpseudocolor">
    <rasterTransparency/>
    <rastershader>
    <colorrampshader colorRampType="DISCRETE" clip="0">
    <item alpha="255" value="1" label="山林・荒地等" color="#267500"/>
    <item alpha="255" value="2" label="" color="#a3ff73"/>
    <item alpha="255" value="3" label="畑・その他の農地" color="#ffd37f"/>
    <item alpha="255" value="4" label="造成中地" color="#686868"/>
    <item alpha="255" value="5" label="空地" color="#ffff00"/>
    <item alpha="255" value="6" label="工業用地" color="#0070ff"/>
    <item alpha="255" value="7" label="一般低層住宅" color="#ffbee8"/>
    <item alpha="255" value="8" label="密集低層住宅地" color="#ff73df"/>
    <item alpha="255" value="9" label="中高層住宅地" color="#ff00c5"/>
    <item alpha="255" value="10" label="商業・業務地区" color="#ff0000"/>
    <item alpha="255" value="11" label="道路用地" color="#d7c29e"/>
    <item alpha="255" value="12" label="公園・緑地等" color="#70a800"/>
    <item alpha="255" value="13" label="その他の公共公益施設" color="#a900e6"/>
    <item alpha="255" value="14" label="河川・湖沼等" color="#00a5ff"/>
    <item alpha="255" value="15" label="その他" color="#828282"/>
    <item alpha="255" value="16" label="" color="#002673"/>
    <item alpha="255" value="17" label="その他" color="#fffff0"/>
    <item alpha="255" value="18" label="ダミーコード" color="#000000"/>
    <item alpha="255" value="19" label="ダミーコード" color="#000000"/>
    </colorrampshader>
    </rastershader>
    </rasterrenderer>
    <brightnesscontrast brightness="0" contrast="3"/>
    <huesaturation colorizeGreen="128" colorizeOn="0" colorizeRed="255" colorizeBlue="128" grayscaleMode="0" saturation="0" colorizeStrength="100"/>
    <rasterresampler maxOversampling="2"/>
    </pipe>
    <blendMode>0</blendMode>
    </qgis>