SlideShare una empresa de Scribd logo
1 de 49
http://en.wikipedia.org/wiki/
File:Bundesarchiv_Bild_102-08759,_Flugzeug_Junkers_G-24.jpg
Attribution: Bundesarchiv, Bild 102-08759 / Unknown / CC-BY-SA
No. 386
$KCODE = 'u'
require 'rubygems'
require 'sequel'
require 'geo_ruby'

DB = Sequel::connect('postgres://fitter:happier@localhost/more_productive',
  :encoding => 'UTF-8')

DB.create_table!(:japan_highway) do
  primary_key :gid
  String :type
  String :name
  boolean :oneway
  real :lanes
end
DB["SELECT AddGeometryColumn('', 'japan_highway', 'the_geom', '4326', 'MULTILINESTRING', 2);"].first

DB.transaction {
  GeoRuby::Shp4r::ShpFile.open('japan_highway.shp') {|shp|
    shp.each {|r|
      DB[:japan_highway].insert({
         :type => r.data['TYPE'],
         :name => r.data['NAME'],
         :oneway => r.data['ONEWAY'] == 'yes',
         :lanes => r.data['LANES'].to_f,
         :the_geom => :ST_GeomFromText.sql_function(r.geometry.as_wkt, 4326)
      })
    }
  }
}
class App < Sinatra::Base
  DB = Sequel::connect('postgres://fitter:happier@localhost/more_productive')

  get '/geohash/:file_name' do
    content_type 'text/html'
    geohash = params[:file_name].sub('.html', '')
    extent = GeoHash.decode(geohash)
    ...
    bbox = "ST_GeomFromText('POLYGON ((#{lng0} #{lat0}, #{lng1} #{lat0}, #{lng1} #{lat1}, #{lng0} #{lat1}, #{lng0} #{lat0}))', 4326)"
    @dataset = DB["SELECT ST_AsSVG(ST_Affine(ST_Intersection(the_geom, #{bbox}), #{a}, #{b}, #{d}, #{e}, #{x_off}, #{y_off}), 0, 0),
type, name FROM japan_highway WHERE ST_Intersects(the_geom, #{bbox});"]
    instr = []
    @dataset.each {|r|
       instr << "        r.path('#{r[:st_assvg]}').attr('stroke', '#{color}');n"
    }
    s = haml <<-EOS
!!!XML
%html
  ...
  %body
    :javascript
       window.onload = function() {
         ...
         });
         window.document.addEventListener('touchstart', function(evt) {
           ...
         }, false);
       ...
       }
    EOS
    File.open("public/geohash/#{geohash}.html", 'w') {|w|
       w.print s
    }
    s
  end
end

App.run! :port => 2010
require 'app'
run Sinatra::Application


require 'rubygems'
require 'sinatra'

get '/' do
  redirect '/geohash/xn77n.html'
end


require 'rubygems'
require 'pr_geohash'
require 'open-uri'

ALPHABET = "0123456789bcdefghjkmnpqrstuvwxyz"

def get(geohash)
  url = "http://localhost:2010/geohash/#{geohash}.html"
  print url, "n"
  open url
end

%w{xn7 xnk}.each {|seed|
  ALPHABET.each_char {|c1|
    ALPHABET.each_char {|c2|
      get(seed + c1 + c2)
    }
  }
}


$   sudo gem install heroku
$   heroku create degree-zero-web-mapping
$   git init
$   git add .
$   git commit
$   git push heroku master
Demo
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性

Más contenido relacionado

La actualidad más candente

Nomethoderror talk
Nomethoderror talkNomethoderror talk
Nomethoderror talk
Jan Berdajs
 
Let's Build A Gutenberg Block | WordCamp Europe 2018
Let's Build A Gutenberg Block | WordCamp Europe 2018Let's Build A Gutenberg Block | WordCamp Europe 2018
Let's Build A Gutenberg Block | WordCamp Europe 2018
Lara Schenck
 
Build web application by express
Build web application by expressBuild web application by express
Build web application by express
Shawn Meng
 
hachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JShachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JS
Kotaro Kawashima
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus Bundles
Albert Jessurum
 
Plone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope RpxPlone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope Rpx
Paris, France
 

La actualidad más candente (20)

Nomethoderror talk
Nomethoderror talkNomethoderror talk
Nomethoderror talk
 
API Design
API DesignAPI Design
API Design
 
AngularJS - $http & $resource Services
AngularJS - $http & $resource ServicesAngularJS - $http & $resource Services
AngularJS - $http & $resource Services
 
Let's Build A Gutenberg Block | WordCamp Europe 2018
Let's Build A Gutenberg Block | WordCamp Europe 2018Let's Build A Gutenberg Block | WordCamp Europe 2018
Let's Build A Gutenberg Block | WordCamp Europe 2018
 
Hacking the Internet of Things for Fun & Profit
Hacking the Internet of Things for Fun & ProfitHacking the Internet of Things for Fun & Profit
Hacking the Internet of Things for Fun & Profit
 
Expressを使ってみた
Expressを使ってみたExpressを使ってみた
Expressを使ってみた
 
«Работа с базами данных с использованием Sequel»
«Работа с базами данных с использованием Sequel»«Работа с базами данных с использованием Sequel»
«Работа с базами данных с использованием Sequel»
 
Build web application by express
Build web application by expressBuild web application by express
Build web application by express
 
hachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JShachioji.pm #40 : asynchronous in JS
hachioji.pm #40 : asynchronous in JS
 
Couchdb
CouchdbCouchdb
Couchdb
 
AngularJS Routing
AngularJS RoutingAngularJS Routing
AngularJS Routing
 
Desymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus BundlesDesymfony 2011 - Habemus Bundles
Desymfony 2011 - Habemus Bundles
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
 
LINE iOS開発で実践しているGit tips
LINE iOS開発で実践しているGit tipsLINE iOS開発で実践しているGit tips
LINE iOS開発で実践しているGit tips
 
Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase Vue.js SSR with Nuxt.js and Firebase
Vue.js SSR with Nuxt.js and Firebase
 
Java&Script
Java&ScriptJava&Script
Java&Script
 
Plone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope RpxPlone Conference 2008 Lightning Talk Static Zope Rpx
Plone Conference 2008 Lightning Talk Static Zope Rpx
 
Dion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
Dion Almaer & Ben Galbraith - Build Once, Deploy EverywhereDion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
Dion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Как показать 90 млн картинок и сохранить жизнь диску
Как показать 90 млн картинок и сохранить жизнь дискуКак показать 90 млн картинок и сохранить жизнь диску
Как показать 90 млн картинок и сохранить жизнь диску
 

Similar a Web+GISという視点から見たGISの方向性

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
偉格 高
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
Eldar Djafarov
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
gerbille
 

Similar a Web+GISという視点から見たGISの方向性 (20)

node.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.io
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.js
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
 
dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Nodejs do teste de unidade ao de integração
Nodejs  do teste de unidade ao de integraçãoNodejs  do teste de unidade ao de integração
Nodejs do teste de unidade ao de integração
 
Intro to Sail.js
Intro to Sail.jsIntro to Sail.js
Intro to Sail.js
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
 
Express JS
Express JSExpress JS
Express JS
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 

Más de Hidenori Fujimura (8)

150702 クライシスマッピングワークショップ@青山学院大学
150702 クライシスマッピングワークショップ@青山学院大学150702 クライシスマッピングワークショップ@青山学院大学
150702 クライシスマッピングワークショップ@青山学院大学
 
FOSS4G 2014 Tokyo 基調講演「GSI for All」
FOSS4G 2014 Tokyo 基調講演「GSI for All」FOSS4G 2014 Tokyo 基調講演「GSI for All」
FOSS4G 2014 Tokyo 基調講演「GSI for All」
 
140619 地理院ckanの舞台裏から
140619 地理院ckanの舞台裏から140619 地理院ckanの舞台裏から
140619 地理院ckanの舞台裏から
 
JavaScriptでキャッシュつき地図(GEO x CODEライトニングトーク)
JavaScriptでキャッシュつき地図(GEO x CODEライトニングトーク)JavaScriptでキャッシュつき地図(GEO x CODEライトニングトーク)
JavaScriptでキャッシュつき地図(GEO x CODEライトニングトーク)
 
FOSS4Gで地理院地図
FOSS4Gで地理院地図FOSS4Gで地理院地図
FOSS4Gで地理院地図
 
地図インフラのAPIからの独立について
地図インフラのAPIからの独立について地図インフラのAPIからの独立について
地図インフラのAPIからの独立について
 
FOSS4GとWebによる地図公開の共有
FOSS4GとWebによる地図公開の共有FOSS4GとWebによる地図公開の共有
FOSS4GとWebによる地図公開の共有
 
Sharing the Openness of the Maps via FOSS4G and the Web
Sharing the Openness of the Maps via FOSS4G and the WebSharing the Openness of the Maps via FOSS4G and the Web
Sharing the Openness of the Maps via FOSS4G and the Web
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Web+GISという視点から見たGISの方向性

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43. $KCODE = 'u' require 'rubygems' require 'sequel' require 'geo_ruby' DB = Sequel::connect('postgres://fitter:happier@localhost/more_productive', :encoding => 'UTF-8') DB.create_table!(:japan_highway) do primary_key :gid String :type String :name boolean :oneway real :lanes end DB["SELECT AddGeometryColumn('', 'japan_highway', 'the_geom', '4326', 'MULTILINESTRING', 2);"].first DB.transaction { GeoRuby::Shp4r::ShpFile.open('japan_highway.shp') {|shp| shp.each {|r| DB[:japan_highway].insert({ :type => r.data['TYPE'], :name => r.data['NAME'], :oneway => r.data['ONEWAY'] == 'yes', :lanes => r.data['LANES'].to_f, :the_geom => :ST_GeomFromText.sql_function(r.geometry.as_wkt, 4326) }) } } }
  • 44. class App < Sinatra::Base DB = Sequel::connect('postgres://fitter:happier@localhost/more_productive') get '/geohash/:file_name' do content_type 'text/html' geohash = params[:file_name].sub('.html', '') extent = GeoHash.decode(geohash) ... bbox = "ST_GeomFromText('POLYGON ((#{lng0} #{lat0}, #{lng1} #{lat0}, #{lng1} #{lat1}, #{lng0} #{lat1}, #{lng0} #{lat0}))', 4326)" @dataset = DB["SELECT ST_AsSVG(ST_Affine(ST_Intersection(the_geom, #{bbox}), #{a}, #{b}, #{d}, #{e}, #{x_off}, #{y_off}), 0, 0), type, name FROM japan_highway WHERE ST_Intersects(the_geom, #{bbox});"] instr = [] @dataset.each {|r| instr << " r.path('#{r[:st_assvg]}').attr('stroke', '#{color}');n" } s = haml <<-EOS !!!XML %html ... %body :javascript window.onload = function() { ... }); window.document.addEventListener('touchstart', function(evt) { ... }, false); ... } EOS File.open("public/geohash/#{geohash}.html", 'w') {|w| w.print s } s end end App.run! :port => 2010
  • 45. require 'app' run Sinatra::Application require 'rubygems' require 'sinatra' get '/' do redirect '/geohash/xn77n.html' end require 'rubygems' require 'pr_geohash' require 'open-uri' ALPHABET = "0123456789bcdefghjkmnpqrstuvwxyz" def get(geohash) url = "http://localhost:2010/geohash/#{geohash}.html" print url, "n" open url end %w{xn7 xnk}.each {|seed| ALPHABET.each_char {|c1| ALPHABET.each_char {|c2| get(seed + c1 + c2) } } } $ sudo gem install heroku $ heroku create degree-zero-web-mapping $ git init $ git add . $ git commit $ git push heroku master
  • 46.
  • 47. Demo

Notas del editor