Mais conteúdo relacionado
Semelhante a MySQL 8.0で強化されたGIS機能のご紹介:「FOSS4G 2018 Hokkaido」での発表資料 (20)
MySQL 8.0で強化されたGIS機能のご紹介:「FOSS4G 2018 Hokkaido」での発表資料
- 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL 8.0で強化されたGIS機能のご紹介
Yoshiaki Yamasaki / 山﨑 由章
MySQL Global Business Unit
MySQL Senior Sales Consultant
updated: 2018/06/23
- 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
Safe Harbor Statement
以下の事項は、弊社の一般的な製品の方向性に関する概要を説明するものです。
また、情報提供を唯一の目的とするものであり、いかなる契約にも組み込むことはでき
ません。以下の事項は、マテリアルやコード、機能を提供することをコミットメントするも
のではない為、購買決定を行う際の判断材料になさらないで下さい。
オラクル製品に関して記載されている機能の開発、リリースおよび時期については、
弊社の裁量により決定されます。
2
- 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
今日伝えたいこと
• MySQLにもGIS機能があります!積極的に開発しています!!
• ご意見下さい!
– 本日は終日会場にいます
– 懇親会も参加します
• 試してみて気づいた点があれば、是非フィードバック下さい!
– フィードバックできるページ
• MySQL Bugs
https://bugs.mysql.com/
– バグ報告だけでなく、機能追加リクエストも受け付けています
4
- 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQLのGIS機能の歴史
5
- 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 6
MySQLの歴史
4.0
全文検索 (MyISAM)
複数テーブルUPDATE/DELETE
組み込みライブラリ型サーバ
OracleMySQL Sun
3.23
MyISAM
InnoDB
レプリケーション
5.1
プラグガブル・
ストレージエンジン・
アーキテクチャ
パーティショニング
タスクスケジューラ
5.6
全文検索(InnoDB)
memcached API
UNDO表領域
Global Transaction ID
マルチスレッドスレーブ
オンラインALTER TABLE
トランスポータブル表領域
5.5
InnoDBがデフォルトに
準同期型レプリケーション
PERFORMANCE_SCHEMA
1.0-3.22以前
ストレージエンジン (ISAM, HEAP)
マルチスレッド
Windows対応/64bit対応
日本語文字コード (SJIS/UJIS)
5.0
ストアドプロシージャ
ストアドファンクション
カーソル/トリガ/ビュー
XAトランザクション
INFORMATION_SCHEMA
4.1
GIS(MyISAM)
Unicode対応
サブクエリ
CSV, ARCHIVE
ndbcluster
1995 2000 2005 2010 2015
5.7
2015年10月21日 GA
全文検索CJK対応/GIS (InnoDB)
新コストモデル オプティマイザ
ロスレス レプリケーション
マルチソース レプリケーション
グループ レプリケーション
セキュリティ強化
データディクショナリ
NoSQLオプション
・ 1995年:スウェーデンにてMySQL AB設立
・(2005年:オラクルがInnobase Oyを買収)
・ 2008年:Sun MicrosystemsがMySQL ABを買収
・ 2010年:オラクルがSun Microsystemsを買収
8.0
2018年4月19日 GA
トランザクショナルDD
MySQLドキュメントストア
Unicode 9.0サポート
国ごとの照合順序を追加
CTE、Window関数
GIS機能の拡張 (InnoDB)
- 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GIS機能の歴史
• MySQL 4.1
– MyISAMでのみGIS機能が使えるようになった
• geometryデータ型
• Spatialインデックス
• Spatial関数
• MySQL 5.0
– InnoDBでもgeometryデータ型、Spatial関数を扱えるようになった
• Spatialインデックスは使用できず
※地理情報システムに関するオープンな規格であるOpenGISに基づいた実装が
されていたが、MySQL開発チームによる独自実装であった
7
- 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GIS機能の歴史
• MySQL 5.7
– Boost.GeometryというC++のオープンソースライブラリを採用して独自実装をやめ、
InnoDBでGIS関連機能を再実装した
• geometryデータ型
• Spatialインデックス
• Spatial関数(使える関数の種類も増加)
• GeoHashサポート
• GeoJSONサポート
※Boost.Geometryコミュニティとも活発に交流し、MySQLチームから
Boost.Geometryへのコントリビュートも行っている
8
- 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GIS機能の歴史
• MySQL 5.7
– 挙動が不明確で分かり難いSpatial関数は非推奨となった
• 例:Contains()は、以下のどちらの関数と同じ動きをするか分かり難いので廃止予定となった
– MBRContains
– ST_Contains()
9
- 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GIS機能の歴史
• MySQL 8.0
– OpenGIS標準準拠
– 演算、データ変換に役立つ各種のSpatial関数の追加
• st_x(geom, x)
• st_y(geom, y)
• st_srid(geom, srid)
– MySQL 5.7で非推奨になった関数の廃止
–Geography サポート
• st_distance() 関数
–Spatial Data、Spatial Index、Spatial関数のSRIDサポート
10
- 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GIS機能の歴史
• MySQL 8.0
– OpenGIS標準準拠
– 演算、データ変換に役立つ各種のSpatial関数の追加
• st_x(geom, x)
• st_y(geom, y)
• st_srid(geom, srid)
– MySQL 5.7で非推奨になった関数の廃止
–Geography サポート
• st_distance() 関数
–Spatial Data、Spatial Index、Spatial関数のSRIDサポート
11
- 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQLは積極的に
GIS機能を開発しています!!
12
- 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
geometryデータ型
• OpenGISジオメトリモデルに基づいた以下のデータが使用可能
– GEOMETRY、GEOMETRYCOLLECTION
– 点:POINT、MULTIPOINT
– 線:LINESTRING、MULTILINESTRING
– 多角形:POLYGON、MULTIPOLYGON
※GEOMETRYには、POINT、LINESTRING、POLYGONを格納可能
※GEOMETRYCOLLECTIONには、MULTIPOINT、MULTILINESTRING、MULTIPOLYGONを
格納可能
14
- 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
Spatial関数
• ジオメトリデータを扱える各種の関数
• 例
– ST_Distance()
• 2つのジオメトリを入力し、2地点間の距離を出力
– ST_Distance_Sphere()
• 2つのジオメトリを入力し、2地点間の最小球面距離を出力
– ST_Contains()
• あるジオメトリに別のジオメトリが含まれているかどうかを判定する
• MySQL 8.0で使えるSpatial関数一覧
– MySQL 8.0 Reference Manual / ... / 12.15.1 Spatial Function Reference
https://dev.mysql.com/doc/refman/8.0/en/spatial-function-reference.html
15
- 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GeoHash
• 経緯度の情報を文字列化したもの
– 例:ACU-A(アスティ45)のGeoHash(経度:141.348104、緯度:43.066236)
⇒ xpssbryx18<<後略>>
• 特徴
– 文字列なので、データベースで扱いやすい
(インデックスも活用可能)
– GeoHashの情報は点ではなく範囲(矩形のエリア)を表す
– 文字列の桁数で精度を変えることができる
• 10桁を超えると矩形の一辺が1m以下になるので、経緯度の変わりとしても十分利用可能
• 近接エリアの判定等に利用可能
16
- 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GeoHash
• MySQL 5.7以降では、GeoHashを扱うための関数が使用できる
– ST_GeoHash():経度、緯度(POINT型のデータでも可)を入力し、GeoHashを出力
– ST_LatFromGeoHash():GeoHashを入力し、経度を出力
– ST_LongFromGeoHash():GeoHashを入力し、緯度を出力
– ST_PointFromGeoHash():GeoHashを入力し、POINT型のデータを出力
17
※詳細を解説しているマニュアル
MySQL 8.0 Reference Manual / ... / 12.15.10 Spatial Geohash Functions
https://dev.mysql.com/doc/refman/8.0/en/spatial-geohash-functions.html
- 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GeoJSON
• 空間データを扱うためのフォーマットの一つ
• JSONによる表現で空間データを扱える
– 例:ACU-A(アスティ45)のGeoHash(経度:141.348104、緯度:43.066236)の
GeoJSONによる表現
⇒ {"type": "Point", "coordinates": [141.348104, 43.066236]}
18
- 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
GeoJSON
• MySQL 5.7以降では、GeoJSONを扱うための関数が使用できる
– ST_AsGeoJSON():ジオメトリ型のデータを入力し、GeoJSONデータを出力
– ST_GeomFromGeoJSON():GeoJSONデータを入力し、ジオメトリ型のデータを出力
19
※詳細を解説しているマニュアル
MySQL 8.0 Reference Manual / ... / 12.15.11 Spatial GeoJSON Functions
https://dev.mysql.com/doc/refman/8.0/en/spatial-geojson-functions.html
- 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbenchの活用
20
- 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench
• 管理ツール
• SQLエディタ
• Performance Dashboard
• Visual Explain
• GIS Viewer
• ER図作成、フォワード/
リバースエンジニアリング、
など豊富な機能
21
データベースアーキテクト、開発者、DBA のための統合ビジュアルツール
商用版のみの機能:
DBドキュメント出力、データモデルの検証、
MySQL Enterprise Backup GUI、MySQL Enterprise Audit GUI
- 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench – 起動後の画面
• クライアントPCにインストールし、
MySQLデータベースへの
接続定義を作成して接続
22
- 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench – 管理
• サーバーステータス
• クライアントコネクション
一覧
• ユーザー管理
• データDump/Import
• サーバー起動/停止
• パフォーマンスレポート
• パフォーマンススキーマの
設定変更、など
23
- 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench – 開発支援:SQL Editor
• SQLエディタ
– キーワードハイライト
– SQL整形
– スニペット、など
• Visual Explain
• オブジェクト確認
• データ確認/編集
• オブジェクト作成、など
24
- 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench – モデリング
• ER図作成
• フォワードエンジニアリング
• リバースエンジニアリング
• ドキュメント出力(商用版のみ)
• データモデルの検証
(商用版のみ)
• データモデルとDBの同期、
など
25
- 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Workbench – データベース・マイグレーション・ウィザード
• 移行元
– Microsoft SQL Server, PostgreSQL,
Sybase ASE, Sybase SQL Anywhere,
SQLite, Microsoft Access, MySQL, and more
• オブジェクトとデータの移行
• MySQLバージョンアップグレード
(テスト環境用)
26
- 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
"Spatial Viewer" and "Geometry Viewer"
• ジオメトリ型のデータを図示可能
27
- 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
参考情報
• マニュアル
– https://dev.mysql.com/doc/refman/8.0/en/
• コミュニティフォーラム
– http://forums.mysql.com/list.php?23
• Boost.Geometry
– http://www.boost.org/libs/geometry
• バグ報告&機能追加リクエスト
– http://bugs.mysql.com/
29
- 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
参考情報
• MySQL開発チームのブログ記事(GIS機能開発者の投稿記事)
https://mysqlserverteam.com/author/nryeng/
– 例)
• Spatial Reference Systems in MySQL 8.0
• Geography in MySQL 8.0
• Axis Order in Spatial Reference Systems
• Geographic Indexes in InnoDB
• Geographic Spatial Reference Systems in MySQL 8.0
• Projected Spatial Reference Systems in MySQL 8.0
• Upgrading Spatial Indexes to MySQL 8.0
• Creating Your Own Spatial Reference Systems in MySQL 8.0
30
- 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
参考情報
• MySLQ 8.0 GIS Demos
https://github.com/nryeng/mysql-8.0-gis-demos
– OpenLayers、OpenStreetMap、ProxySimplePHPのタイルキャッシュを使用したデモ
(MySQL 8.0がGA(製品版)になる前に作成されたデモ)
31
- 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
フィードバック協力者募集中!!
33
- 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Bugsでのフィードバック
• MySQL Bugs
– https://bugs.mysql.com/
• バグ報告だけでなく、機能追加リクエストも受け付けています
– 特に、日本固有のGIS事情に合わせた機能追加リクエストを登録頂けると助かります
• 「Affect me」ボタンを押すことで、
– 他の人が登録したバグと同じバグに遭遇した
– その機能追加を私も望んでいる
ということを伝えることができます
34
- 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL Bugsでのフィードバック
• 私が登録している機能追加リクエスト
– Bug#88871 : Add ST_Transform() function to transform geometry data to different SRID
https://bugs.mysql.com/bug.php?id=88871
– Bug#90023 : [Feature request] Shape File import/export tool
https://bugs.mysql.com/bug.php?id=90023
35
- 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
開発者へ直接フィードバック
• 口頭でご説明します
36