Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Geo on Rails
Search
Guilherme Vinicius Moreira
June 19, 2012
Programming
3
170
Geo on Rails
Guilherme Vinicius Moreira
June 19, 2012
Tweet
Share
More Decks by Guilherme Vinicius Moreira
See All by Guilherme Vinicius Moreira
Introdução ao conceito de Gamificação
guivinicius
0
310
Other Decks in Programming
See All in Programming
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
200
Webサーバーサイド言語としてのRustについて
kouyuume
0
280
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
240
Go Conference 2025: Goで体感するMultipath TCP ― Go 1.24 時代の MPTCP Listener を理解する
takehaya
9
1.7k
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
270
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
170
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
460
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
11
6.9k
One Enishi After Another
snoozer05
PRO
0
120
理論と実務のギャップを超える
eycjur
0
140
非同期jobをtransaction内で 呼ぶなよ!絶対に呼ぶなよ!
alstrocrack
0
990
ALL CODE BASE ARE BELONG TO STUDY
uzulla
25
6.3k
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Faster Mobile Websites
deanohume
310
31k
A Modern Web Designer's Workflow
chriscoyier
697
190k
A Tale of Four Properties
chriscoyier
161
23k
Docker and Python
trallard
46
3.6k
Making Projects Easy
brettharned
120
6.4k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Building Applications with DynamoDB
mza
96
6.7k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
Transcript
Geo On Rails Um guia para manter o seu cabelo.
por @guivinicius
whoami Guilherme || Harry Desenvolvedor na Novakoasin Um dos fundadores
do GURU Sorocaba
Motivo
Objetivo Dar uma visão e as ferramentas para um estudo
detalhado.
Metas - Explicar os termos - Mostrar ferramentas para Ruby
/ Rails - Um pouco código.
Programação Espacial
Programação Espacial Tratar espaços e objetos físicos no contexto de
programação. Interação e relacionamento entre esses objetos físicos.
Programação Espacial Me ache as linhas de ônibus que coincidam
o trajeto em uma percentagem maior que 60%. Me retorne todos os veículos que passaram num raio de 10km da usina nuclear XYZ no dia 10/11/2012.
Termos Importantes GIS: Geographical Information System Layers: Camadas WMS: Web
Mapping Service. Projeção: Representação plana do globo. Geometria: Tipo de dados em um GIS.
GIS Sistemas que representam dados geográficos.
GIS Sistemas que representam dados geográficos.
Layers Camadas que podem agrupar dados. RASTER VECTOR
Layers
WMS http://openstreetmap.org
WMS http://worldwind.arc.nasa.gov/java/
WMS http://maps.yahoo.com/
WMS http://br.bing.com/maps/
WMS http://www.mapmatters.org/ ou Mapserver http://mapserver.org/ ou $$ Soluções Privadas $$
Projeções Meio de representar uma superfície esférica (Terra) em uma
superfície plana.
Projeções
Projeções SRID: Como a projeção é identificada dentro de um
banco espacial. (System Reference ID) EPSG: 4326 / EPSG: 900913 (Google) http://spatialreference.org/
Geometrias Point Line Polygon • Multiline Multipolygon
Geometrias Geometry Collection • •
Geometrias ESRI Shapefile Mapinfo Formato de dados mais utilizados. .shp
.shx .dbf .tab Contém geometrias e muitas outras informações, como índices e etc.
Ferramentas Bancos da Dados - PostgreSQL + PostGIS - MongoDB
- MySQL - Oracle Spatial the best *PostGIS é uma extensão para o PostgreSQL que adiciona habilidades espaciais.
Ferramentas • Habilidade de armazenar geometrias nas tabelas. • Disponibiliza
funções espaciais como distance() ou intersection() • Implementa índices espaciais. O que eles fazem de diferente ?
Ferramentas Ruby Gems - RGeo - RGeo-geojson - RGeo-shapefile -
ffi-geos - GeoRuby - SpatialAdapter - Ruby geocoder - Squeel
Ferramentas Client-side http://openlayers.org/
Ferramentas Client-side Heatmaps https://github.com/pa7/heatmap.js https://github.com/dazuma/thermo.js https://github.com/sunng87/heatcanvas
Ferramentas
Ferramentas http://www.qgis.org/
Ferramentas http://mapserver.org/ http://www.pgrouting.org/ Publicar dados espaciais na web, criar seu
próprio WMS. Estende o PostgreSQL + PostGIS para algoritmos de roteamento.
Meu ‘stack’ atual PostgreSQL + PostGIS + PgRouting GeoRuby +
SpatialAdapter OpenLayers Mapserver
Código !! gemfile
Código !! database.yml * Documentado na gem activerecord-postgis-adapter
Código !! tipo point! <RGeo::Geographic::SphericalPointImpl:0x806532d8 "POINT (-47.45590989999999 -23.5062288)">
Código !! p1.latlon.distance(p2.latlon) => 3802.0170205027907 (miles)
Pra onde ir daqui. • Instale alguns bancos espaciais (PostgreSQL)
• gem install nas gems mencionadas. • Crie uma app Rails e com objetos espaciais • Utilize o OpenLayers e mostre alguns dados.
Fontes de dados. http://www.naturalearthdata.com/downloads/ http://geocommons.com/ http://dados.gov.br/ http://www.ibge.gov.br/mapas_ibge/bases.php
Obrigado! @guivinicius @gurusorocaba Perguntas ?