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
国交省のデータをSolrで検索
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ryo0301
July 29, 2013
Technology
1.3k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
国交省のデータをSolrで検索
SHAPE > PostGIS > Solr > Google Map
ryo0301
July 29, 2013
More Decks by ryo0301
See All by ryo0301
Blockchain x Slack botでピアボーナス
ryo0301
0
290
Quorum on AWS
ryo0301
0
650
Other Decks in Technology
See All in Technology
What the customer really needed
kawaguti
PRO
3
210
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
130
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.2k
Genieを崇めよ
kameitomohiro
0
160
Minecraft JavaのMODをSwiftで作る
1mash0
0
180
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
130
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
210
品質と信頼性を地続きにする
grimoh
1
790
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
950
あけおめLINE 傾向とその対策
nasa9084
0
140
AI de Idea
kawaguti
PRO
2
120
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
170
Featured
See All Featured
Being A Developer After 40
akosma
91
590k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
A designer walks into a library…
pauljervisheath
211
25k
We Are The Robots
honzajavorek
0
380
We Have a Design System, Now What?
morganepeng
55
8.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Building the Perfect Custom Keyboard
takai
2
880
A Soul's Torment
seathinner
8
3.6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
Transcript
国土交通省のデータをSolrで検索 株 式 会 社 ネ ク ス ト 秀
野 亮 @ r y o 0 3 0 1
自己紹介 秀野 亮 株式会社ネクスト @ryo0301 不動産・住宅情報サイト HOME'S http://www.homes.co.jp/ 最近の仕事 Solr
-> AWS -> DQ10
発表の概要 Lucene/Solr4の新しい(地理)空間検索 http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 上記の機能を使ったデモとその説明 国交省のデータ -> PostGIS -> Solr
デモ:想定した機能 地図上の小学校から、その学区内の物件を検索 小学校をクリック 学区を表示 学区内の物件を表示 地図上の指定した範囲の物件を検索 おまけ 内部的には同じ機能
デモ:環境 バージョン(5月時点の最新版) Solr4.3.0 PostGIS2.0.3 データ 東京都のデータ POLYGON:学区 POINT:小学校、公園、公共施設、バス停 ※物件代わりに利用
デモ:やります 少々お待ちください
デモ:実演中…
事前知識 説明の前に軽く事前知識を・・・
事前知識:ジオメトリデータ 点:駅/物件など POINT MULTIPOINT 線:路線など LINESTRING MULTILINESTRING 面:市区町村/学区など POLYGON MULTIPOLYGON
事前知識:WKB/WKT形式 WKB Well Known Binary 0101000000000000000000F03F000000000000F03F PostgreSQL(PostGIS)にはWKB形式で格納 WKT Well Known
Text MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7, 5 5))) Solrへのインポート、検索クエリはWKT形式で行う
事前知識:Intersects Intersects 交差するデータを検索する関数
環境:データの流れ &$ TIQQHTRM 1PTU(*4 HFPNLNM LNMT 4 4PMS %*) ࠃަল
環境:SHAPE -> PostGIS &$ TIQQHTRM 1PTU(*4 HFPNLNM LNMT 4 4PMS
%*) ࠃަল
環境:SHAPE -> PostGIS 国土交通省のデータを使って、緯度経度から市区町村までを取り出す http://qiita.com/masuidrive/items/21a282c7bf54fd6a4985
環境:PostGIS -> Solr &$ TIQQHTRM 1PTU(*4 HFPNLNM LNMT 4 4PMS
%*) ࠃަল
環境:PostGIS -> Solr PostGIS -> DIH DIHでDBから一括インポート select *, ST_AsText(geom)
from school_district; ST_AsText関数でWKB→WKT変換 DIH -> Solr SpatialRecursivePrefixTreeFieldType geohashで階層的にインデックスを保持 WKT形式でインポート
環境:PostGIS -> Solr schema.xml <fieldType name="location" class="solr.SpatialRecursivePrefixTreeFieldType" spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" distErrPct="0.025" maxDistErr="0.000009"
units="degrees"/> <field name="geo" type="location" indexed="true" stored="true" multiValued="true"/>
環境:PostGIS -> S3 &$ TIQQHTRM 1PTU(*4 HFPNLNM LNMT 4 4PMS
%*) ࠃަল
環境:PostGIS -> S3 geom2kml select ST_AsKml(geom) from school_district; ST_AsKml関数でKML形式に変換 ERBでKMLファイルを生成
MULTIPOLYGONデータ(学区)が対象 kml2s3 KMLファイルをAmazon S3にアップロード
環境:PostGIS -> S3 ST_AsKml関数の出力結果(MULTIPOLYGON) <MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates >139.763459000000012,35.6... 139.763459000000012,35.663246999999998</coordinates></ LinearRing></outerBoundaryIs></Polygon></MultiGeometry>
環境:Solr/S3 -> Google Map &$ TIQQHTRM 1PTU(*4 HFPNLNM LNMT 4
4PMS %*) ࠃަল
環境:Solr/S3 -> Google Map KmlLayer 学区の範囲をGoogleMap上に表示 S3上のKMLファイルのURLを指定するだけ Solrでの検索 小学校検索 (geo:[10,20
TO 30,40]) 小学校→学区検索 (POINT→MULTIPOLYGON) 学区→物件検索 (MULTIPOLYGON→POINT) 指定範囲検索 (POLYGON→POINT)
実際のクエリ 小学校→学区検索 (POINT→MULTIPOLYGON) fq=geo:"Intersects(POINT(139.7343+35.6364))" 学区→物件検索 (MULTIPOLYGON→POINT) fq=geo:"Intersects(MULTIPOLYGON(((139.737202 35.640305,139.737358 35.640414,...305))))" ※geoフィールドに対して検索
注意点:必要なライブラリ Spatial4J https://github.com/spatial4j/spatial4j geospatial JTS http://sourceforge.net/projects/jts-topo-suite/ spatial polygon support
注意点:必要なライブラリ Solr adapters Lucene spatial Spatial4J JTS
注意点:インデクシング遅い MULTIPOLYGONのインデクシングが遅い 驚きの遅さ PostGISに間引きしてくれる関数があったような…
EOP ありがとうございました。
蛇足 ネクストでは、 ヌルスタックエンジニアを 募集しています!