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
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
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
760
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Done Done
chrislema
187
17k
New Earth Scene 8
popppiees
4
2.7k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Ethics towards AI in product and experience design
skipperchong
2
440
Claude Code のすすめ
schroneko
67
230k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Between Models and Reality
mayunak
4
500
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
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/
ご清聴ありがとうございます。