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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
180
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
330
#jawssonic2026 あの時代が悪かった ~動かなかったSageMakerと共に迎えたイベント当日~
ktkn1129
0
140
20260912_スクラムにジェネラリストは必要か
ryugen04
0
290
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
440
Amazon S3 Tablesに全部任せてみた結果——コンパクション/スナップショット管理は本当に手放せるか
shigeruoda
1
460
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
コーディングエージェントでM5Stack系の開発を少し試した時の話 / M5 Japan Tour 2026 Autumn 東京
you
PRO
0
110
アリアドネの糸と、20年ごとの建て替え ── 長尾真『電子図書館』を、伊勢で読み直す / Rereading Makoto Nagao’s "Electronic Library" in Ise
ykiyota
0
140
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
230
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
260
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
610
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
280
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
We Are The Robots
honzajavorek
0
350
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Become a Pro
speakerdeck
PRO
31
6.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
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 ありがとうございました。
蛇足 ネクストでは、 ヌルスタックエンジニアを 募集しています!