Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GIS(地理情報システム) - MongoDBによるジオメディア開発
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kengo Imamura
October 05, 2016
2.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GIS(地理情報システム) - MongoDBによるジオメディア開発
Kengo Imamura
October 05, 2016
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Crafting Experiences
bethany
1
350
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
290
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The Invisible Side of Design
smashingmag
301
52k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
560
The agentic SEO stack - context over prompts
schlessera
0
940
エンジニアに許された特別な時間の終わり
watany
109
250k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
580
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
330
Transcript
GIS( 地理情報システム) MongoDB によるジオメディア開発 @chocoken517
保育園探し 保育園一覧だと場所がわかりにくい 地図上で保育園の場所がわかるようにしたい 通勤経路にある保育園を知りたい
GIS とは GIS(Geographic Information System: 地理情報シス テム) とは、 位置や空間に関する様々 な情報を、
コン ピュー タを用いて重ね合わせ、 情報の分析・ 解析をお こなったり、 情報を視覚的に表示させるシステム。 [ 参照] GIS ポー タルサイト http://www.gis.go.jp/contents/whatisgis.html
どうやるの?
位置参照デー タベー ス PostGIS PostgreSQL デー タベー スで地理空間情報を扱う ための拡張 MySQL
5.7 からInnoDB での空間インデックス可 MongoDB 地理空間インデックス
MongoDB の位置情報
MongoDB のサポー ト 地理空間インデックス 平面空間(2d) 球面空間(2dsphere) geoNear 指定ポイントから近い順に返すコマンド 空間インデックスが必要 GeoJSON
JavaScript Object Notation (JSON) を基にした 地理空間デー タ交換フォー マット
Ruby on Rails
gem geocoder ジオコー ディング( 住所を地理的座標に変換) mongoid Object-Document-Mapper MongoDB のDSL を提供
geocoder class Place include Mongoid::Document include Geocoder::Model::Mongoid field :address, type:
String field :coordinates, type: Array geocoded_by :address after_validation :geocode end address をもとにジオコー ド取得し coordinates に入れる
index geocoder で最初から設定されているインデックスは 平面空間(2d) で作成されるのでスキップする geocoded_by :address, skip_index: true 球面空間(2dsphere)
インデックス作成されるように設 定する index(coordinates: '2dsphere') index 作成 $ rake db:mongoid:create_indexes
MongoDB で確認 > db.places.getIndexes() [ ~~~ 省略 ~~~ { "v"
: 1, "key" : { "coordinates" : "2dsphere" }, "name" : "coordinates_2dsphere", "ns" : "meeful_development.places", "2dsphereIndexVersion" : 3 } ] >
登録 > Place.new(address: ' 墨田区亀沢一丁目27 番5 号').save => true coordinates
にジオコー ドが入ってることを確認 > Place.where(address: ' 墨田区亀沢一丁目27 番5 号').first .coordinates => [139.7994141, 35.698556]
指定場所から近い順に取得 Place.geo_near(Geocoder.coordinates(' 場所').reverse) .spherical Speee から近い駅順にソー ト > Place .geo_near(Geocoder.coordinates('
東京都港区六本木4-1-4') .reverse) .spherical.each { |a| puts a.address } 六本木駅 麻布十番駅 青山一丁目駅 国立競技場駅 代々 木駅 新宿駅
池袋駅から近い駅順ソー ト > Place.geo_near(Geocoder.coordinates(' 池袋駅').reverse) .spherical.each { |a| puts a.address
} 新宿駅 代々 木駅 国立競技場駅 青山一丁目駅 六本木駅 麻布十番駅
最大距離指定し近い順に取得 max_distance で最大距離指定 会社から2km 以内の駅を取得 km からラジアンに変換 > Place .geo_near(Geocoder.coordinates('
東京都港区六本木4-1-4') .reverse) .spherical .max_distance(Geocoder::Calculations .distance_to_radians(2)) .each { |a| puts a.addres } 六本木駅 麻布十番駅 青山一丁目駅
指定場所から最大距離指定し map に表示するジオメディア 作ってみました
デモ https://meeful.com/
ご清聴ありがとうございます。