- Kibana 指南其他版本
- 什么是 Kibana?
- 8.17 版本的新增功能
- Kibana 概念
- 快速入门
- 设置
- 生产注意事项
- Discover
- 仪表板
- Canvas
- 地图
- 报告和共享
- 机器学习
- Graph
- 告警
- 可观测性
- 搜索
- 安全性
- 开发工具
- Fleet
- Osquery
- 堆栈监控
- 堆栈管理
- REST API
- Kibana 插件
- 问题排查
- 辅助功能
- 发行说明
- 升级说明
- Kibana 8.17.0
- Kibana 8.16.1
- Kibana 8.16.0
- Kibana 8.15.5
- Kibana 8.15.4
- Kibana 8.15.3
- Kibana 8.15.2
- Kibana 8.15.1
- Kibana 8.15.0
- Kibana 8.14.3
- Kibana 8.14.2
- Kibana 8.14.1
- Kibana 8.14.0
- Kibana 8.13.4
- Kibana 8.13.3
- Kibana 8.13.2
- Kibana 8.13.1
- Kibana 8.13.0
- Kibana 8.12.2
- Kibana 8.12.1
- Kibana 8.12.0
- Kibana 8.11.4
- Kibana 8.11.3
- Kibana 8.11.2
- Kibana 8.11.1
- Kibana 8.11.0
- Kibana 8.10.4
- Kibana 8.10.3
- Kibana 8.10.2
- Kibana 8.10.1
- Kibana 8.10.0
- Kibana 8.9.2
- Kibana 8.9.1
- Kibana 8.9.0
- Kibana 8.8.2
- Kibana 8.8.1
- Kibana 8.8.0
- Kibana 8.7.1
- Kibana 8.7.0
- Kibana 8.6.1
- Kibana 8.6.0
- Kibana 8.5.2
- Kibana 8.5.1
- Kibana 8.5.0
- Kibana 8.4.3
- Kibana 8.4.2
- Kibana 8.4.1
- Kibana 8.4.0
- Kibana 8.3.3
- Kibana 8.3.2
- Kibana 8.3.1
- Kibana 8.3.0
- Kibana 8.2.3
- Kibana 8.2.2
- Kibana 8.2.1
- Kibana 8.2.0
- Kibana 8.1.3
- Kibana 8.1.2
- Kibana 8.1.1
- Kibana 8.1.0
- Kibana 8.0.0
- Kibana 8.0.0-rc2
- Kibana 8.0.0-rc1
- Kibana 8.0.0-beta1
- Kibana 8.0.0-alpha2
- Kibana 8.0.0-alpha1
- 开发人员指南
清理您的数据
编辑清理您的数据
编辑Elasticsearch 中的地理空间字段有一些在上传前需要解决的限制。本节将介绍一些方法来帮助排除此类数据中的常见问题。
转换为 GeoJSON 或 Shapefile
编辑使用 ogr2ogr(GDAL/OGR 套件的一部分)将数据集转换为 GeoJSON 或 Esri Shapefile。例如,使用以下命令将 GPX 文件转换为 JSON
# Example GPX file from https://www.topografix.com/gpx_sample_files.asp # # Convert the GPX waypoints layer into a GeoJSON file $ ogr2ogr \ -f GeoJSON "waypoints.geo.json" \ # Output format and file name "fells_loop.gpx" \ # Input File Name "waypoints" # Input Layer (usually same as file name) # Extract the routes layer into a GeoJSON file $ ogr2ogr -f "GeoJSON" "routes.geo.json" "fells_loop.gpx" "routes"
转换为 WGS84 坐标参考系统
编辑Elasticsearch 仅支持 WGS84 坐标参考系统。使用 ogr2ogr
将其他坐标系统转换为 WGS84。
在下面的示例中,ogr2ogr
将 shapefile 从 NAD83 转换为 WGS84。由于源数据集中的 .prj
边车文件,输入 CRS 会自动检测到。
# Example NAD83 file from https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_5m.zip # # Convert the Census Counties shapefile to WGS84 (EPSG:4326) $ ogr2ogr -f "Esri Shapefile" \ "cb_2018_us_county_5m.4326.shp" \ # Output file -t_srs "EPSG:4326" \ # EPSG:4326 is the code for WGS84 "cb_2018_us_county_5m.shp" \ # Input file "cb_2018_us_county_5m" # Input layer
通过将复杂几何图形分解为每个文档一个几何图形来提高性能
编辑有时,地理空间数据集由少量几何图形组成,这些几何图形包含大量的单个部分几何图形。这种情况的一个很好的例子是详细的世界国家边界数据集,其中加拿大或菲律宾等国家的记录有数百个小岛几何图形。根据数据集的最终用途,您可能希望分解此类数据集,以使每个文档保留一个几何图形,从而大大提高索引的性能。
# Example NAD83 file from www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/2016/ler_000b16a_e.zip # # Check the number of input features $ ogrinfo -summary ler_000b16a_e.shp ler_000b16a_e \ | grep "Feature Count" Feature Count: 76 # Convert to WGS84 exploding the multiple geometries $ ogr2ogr \ -f "Esri Shapefile" \ "ler_000b16a_e.4326-parts.shp" \ # Output file -explodecollections \ # Convert multiparts into single records -t_srs "EPSG:4326" \ # Transform to WGS84 "ler_000b16a_e.shp" \ # Input file "ler_000b16a_e" # Input layer # Check the number of geometries in the output file # to confirm the 76 records are exploded into 27 thousand rows $ ogrinfo -summary ler_000b16a_e.4326-parts.shp ler_000b16a_e.4326 \ | grep "Feature Count" Feature Count: 27059
包含大量部分记录的数据集(如上面的示例)甚至可能会在 Kibana Maps 文件上传器中挂起。
降低精度
编辑某些机器生成的数据集存储的小数位数超过严格必要的位数。作为参考,GeoJSON RFC 7946 坐标精度部分 指定六位数字为常见的默认值,大约为地面上的 10 厘米。Maps 应用程序中的文件上传器会自动将精度降低到 6 位小数,但对于大型数据集,最好在上传之前执行此操作。
当请求符合 RFC7946
的文件时,ogr2ogr
生成 7 个十进制度的 GeoJSON 文件,但使用 COORDINATE_PRECISION
GeoJSON 图层创建选项,如果适合数据的使用,可以进一步缩小。
# Example NAD83 file from https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_5m.zip # # Generate a 2008 GeoJSON file $ ogr2ogr \ -f GeoJSON \ "cb_2018_us_county_5m.4326.geo.json" \ # Output file -t_srs "EPSG:4326" \ # Convert to WGS84 -lco "RFC7946=NO" \ # Request a 2008 GeoJSON file "cb_2018_us_county_5m.shp" \ "cb_2018_us_county_5m" # Generate a RFC7946 GeoJSON file $ ogr2ogr \ -f GeoJSON \ "cb_2018_us_county_5m.4326.RFC7946.geo.json" \ # Output file -t_srs "EPSG:4326" \ # Convert to WGS84 -lco "RFC7946=YES" \ # Request a RFC7946 GeoJSON file "cb_2018_us_county_5m.shp" \ "cb_2018_us_county_5m" # Generate a RFC7946 GeoJSON file with just 5 decimal figures $ ogr2ogr \ -f GeoJSON \ "cb_2018_us_county_5m.4326.RFC7946_mini.geo.json" \ # Output file -t_srs "EPSG:4326" \ # Convert to WGS84 -lco "RFC7946=YES" \ # Request a RFC7946 GeoJSON file -lco "COORDINATE_PRECISION=5" \ # Downsize to just 5 decimal positions "cb_2018_us_county_5m.shp" \ "cb_2018_us_county_5m" # Compare the disk size of the three output files $ du -h cb_2018_us_county_5m.4326*.geo.json 7,4M cb_2018_us_county_5m.4326.geo.json 6,7M cb_2018_us_county_5m.4326.RFC7946.geo.json 6,1M cb_2018_us_county_5m.4326.RFC7946_mini.geo.json
简化区域数据集
编辑区域数据集是多边形数据集,其中文档的边界不重叠。这在行政边界、土地使用和其他连续数据集中很常见。此类数据集的特殊之处在于,任何修改多边形线的地理空间操作都需要以相同的方式应用于多边形的公共边,以避免生成细间隙和重叠伪影。
mapshaper
是处理此类数据集的绝佳工具,因为它了解此类数据集的性质并据此处理。
根据区域数据集的用途,不同的地理空间精度可能足够。为整个地球显示的全球国家数据集不需要与南亚大陆国家地图相同的精度。
mapshaper
提供了一个 simplify
命令,该命令接受百分比、分辨率和不同的简化算法。
# Example NAD83 file from https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_5m.zip # # Generate a baseline GeoJSON file from OGR $ ogr2ogr \ -f GeoJSON "cb_2018_us_county_5m.ogr.geo.json" \ -t_srs "EPSG:4326" \ -lco RFC7946=YES \ "cb_2018_us_county_5m.shp" \ "cb_2018_us_county_5m" # Simplify at different percentages with mapshaper $ for pct in 10 50 75 99; do \ mapshaper \ -i "cb_2018_us_county_5m.shp" \ # Input file -proj "EPSG:4326" \ # Output projection -simplify "${pct}%" \ # Simplification -o cb_2018_us_county_5m.mapshaper_${pct}.geo.json; \ # Output file done # Compare the size of the output files $ du -h cb_2018_us_county_5m*.geo.json 2,0M cb_2018_us_county_5m.mapshaper_10.geo.json 4,1M cb_2018_us_county_5m.mapshaper_50.geo.json 5,3M cb_2018_us_county_5m.mapshaper_75.geo.json 6,7M cb_2018_us_county_5m.mapshaper_99.geo.json 6,7M cb_2018_us_county_5m.ogr.geo.json
修复不正确的几何图形
编辑Maps 应用程序需要有效的 GeoJSON 或 Shapefile 数据集。除了提到的 CRS 要求外,几何图形还需要有效。 ogr2ogr
和 mapshaper
都有选项来尝试修复无效的几何图形
- OGR
-makevalid
选项 - Mapshaper
-clean
命令
还有更多
编辑ogr2ogr
和 mapshaper
是出色的地理空间 ETL(提取、转换和加载)实用程序,它们可以执行比此处看到的多得多的操作。详细阅读文档值得投资,以通过删除不需要的字段、优化数据类型、验证值域等来提高数据集的质量。最后,作为命令行实用程序,两者都可以自动化并添加到 QA 管道中。
On this page