Skip to content

Instantly share code, notes, and snippets.

View handygeospatial's full-sized avatar

Hidenori FUJIMURA handygeospatial

View GitHub Profile
# coding: utf-8
# convert.rb
require 'json'
# Meshcode is probably Japanese English.
module Meshcode
def self.width(code)
case code.size
when 8
45.0 / 60 / 60
var std = L.tileLayer(
'http://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png', {
attribution: "地理院タイル(標準地図)",
maxNativeZoom: 17, maxZoom: 22,
filter: function() {
new L.CanvasFilter(this, {
channelFilter: function(img) {
for(var y = 0; y < 256; y++) {
for(var x = 0; x < 256; x++) {
var r = img.data[(x + y * 256) * 4 + 0];
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://handygeospatial.github.io/mapsites/js/leaflet-hash.js"></script>
<script src="http://handygeospatial.github.io/mapsites/js/TileLayer.GeoJSON.js"></script>
@handygeospatial
handygeospatial / ryakugo.json
Last active August 29, 2015 14:05
国土基本情報(kkj)・基盤地図情報(fgd)の略号集(CC0)
{"ryakugo": [
{"code": "DEM", "title": "DEM区画", "kkj": false, "fgd": true},
{"code": "DEM5A", "title": "5mメッシュ(航空レーザ測量)", "kkj": true, "fgd": false},
{"code": "DEM5B", "title": "5mメッシュ(写真測量)", "kkj": true, "fgd": false},
{"code": "DEM10B", "title": "10mメッシュ", "kkj": true, "fgd": false},
{"code": "DEM50", "title": "50mメッシュ", "kkj": true, "fgd": false},
{"code": "DEMPt", "title": "DEM構成点", "kkj": false, "fgd": true},
{"code": "DGHM", "title": "DGHM区画", "kkj": false, "fgd": true},
{"code": "DGHMPt", "title": "DGHM構成点", "kkj": false, "fgd": true},
{"code": "NRPt", "title": "居住地名", "kkj": true, "fgd": false},
@handygeospatial
handygeospatial / area_forecast.geojson
Last active August 29, 2015 14:04
気象庁防災情報XMLフォーマットの「全国・地方予報区等」の実装。習作。出典は http://xml.kishou.go.jp/tec_material.html の「個別コード表」の中にある「20130621_AreaForecast.xls」
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@handygeospatial
handygeospatial / ho.rb
Created June 28, 2014 05:13
ベクトルタイルコンバータ140628
# coding: utf-8
require 'georuby-ext' # gem install georuby-ext
require 'geo_ruby/shp'
require 'fileutils'
require 'json'
include GeoRuby::Shp4r
module Math
def self.sec(x)
1.0 / cos(x)
@handygeospatial
handygeospatial / convert.rb
Created June 6, 2014 11:50
ラインやポリゴンのデータもストリーム処理でベクトルタイルに変換する convert.rb
# coding: utf-8
require 'georuby-ext' # gem install georuby-ext
require 'geo_ruby/shp'
require 'fileutils'
require 'json'
include GeoRuby::Shp4r
module Math
def self.sec(x)
1.0 / cos(x)
{"resolutions": [
{"number": 1, "title": "Election of chairman", "result": "abstention", "by": "France"},
{"number": 2, "title": "Title and scope of ISO/TC 211", "result": "unanimous"},
{"number": 3, "title": "Establishment of Ad hoc groups", "result": "unanimous"},
{"number": 4, "title": "", "result": ""},
{"number": 5, "title": "", "result": ""},
{"number": 6, "title": "", "result": ""},
{"number": 7, "title": "", "result": ""},
{"number": 8, "title": "", "result": ""},
{"number": 9, "title": "", "result": ""},
@handygeospatial
handygeospatial / index.html
Created June 3, 2014 09:35
My Starting-Point Index File
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://handygeospatial.github.io/mapsites/js/leaflet-hash.js"></script>
<style>
body {padding: 0; margin: 0}
# coding: utf-8
# CC0
require 'find'
Find.find('地図記号') {|path|
next unless /svg$/.match path
[12, 18, 24].each {|width|
fn = "#{File.basename(path, File.extname(path))}_#{width}"
cmd = "/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-width=#{width} --export-png=dst/#{fn}.png #{path}"
print cmd, "\n"