Skip to content

Instantly share code, notes, and snippets.

View handygeospatial's full-sized avatar

Hidenori FUJIMURA handygeospatial

View GitHub Profile
@handygeospatial
handygeospatial / map.geojson
Created August 14, 2013 21:32
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@handygeospatial
handygeospatial / direction_of_svg2.markdown
Last active December 27, 2015 23:49
SVG2 の方向性として「XML作法離れ」及び「HTML との融合」があると聞いていたところ、これを表現した文書を見つけたのでまとめてみる。

出典

http://dev.w3.org/SVG/proposals/improving-svg-dom/ でのプロポーザルについて、http://www.xanthir.com/b4RR0 で解説がされている。これを斜め読みして以下の「主なポイント」をまとめてみる。

主なポイント

名前空間の消滅

XML名前空間の存在を事実上消滅させる。具体的には、HTMLの名前空間でも名前空間なしでも動作するようにす。手続き論的にはXML名前空間の作法に従いつつも、XML名前空間を終わらせているように見える。(graceful に終わらせる、と言おうか。)

HTMLとカブるDOM API等を削除

タイトルにあるものの他、a, script 及び style が被っている割に機能が微妙に違うので統合するというように読める。SVG要素からid, xmlbase, className, style, xmllang と xmlspace を消去するように読める。

パス式の強化

SVGの伝家の宝刀、パス式の強化。circular/elliptical arcsをパス式で描けるようにするらしい。

# 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"
@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}
{"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 / 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)
@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 / 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 / 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},
<!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>