diff --git a/docs-overrides/assets/stylesheets/components/_lang-switch.scss b/docs-overrides/assets/stylesheets/components/_lang-switch.scss new file mode 100644 index 00000000000..df515fa9c83 --- /dev/null +++ b/docs-overrides/assets/stylesheets/components/_lang-switch.scss @@ -0,0 +1,50 @@ +.sd-lang-switch { + display: inline-flex; + align-items: stretch; + margin: 0 0.4rem; + padding: 2px; + border: 1px solid rgba(255, 255, 255, 0.45); + border-radius: 999px; + background: rgba(255, 255, 255, 0.08); + font-size: 0.72rem; + line-height: 1; + + &__item { + display: inline-flex; + align-items: center; + padding: 0.28rem 0.7rem; + color: rgba(255, 255, 255, 0.85); + text-decoration: none; + border-radius: 999px; + font-weight: 600; + letter-spacing: 0.02em; + transition: background-color 120ms ease, color 120ms ease; + + &:hover, + &:focus { + color: #ffffff; + background-color: rgba(255, 255, 255, 0.18); + } + + &--active { + color: #ca463a; + background-color: #ffffff; + + &:hover, + &:focus { + color: #ca463a; + background-color: #ffffff; + } + } + } +} + +@media (max-width: 600px) { + .sd-lang-switch { + font-size: 0.68rem; + + &__item { + padding: 0.22rem 0.55rem; + } + } +} diff --git a/docs-overrides/assets/stylesheets/extra.scss b/docs-overrides/assets/stylesheets/extra.scss index 632f78effe5..ff3d71722bc 100644 --- a/docs-overrides/assets/stylesheets/extra.scss +++ b/docs-overrides/assets/stylesheets/extra.scss @@ -13,6 +13,7 @@ @import "components/footer"; @import "components/sidebar"; @import "components/search-tags"; +@import "components/lang-switch"; // Pages @import "pages/page-home"; diff --git a/docs-overrides/main.html b/docs-overrides/main.html index 652d9c4d85d..1098300f0bc 100644 --- a/docs-overrides/main.html +++ b/docs-overrides/main.html @@ -1,9 +1,17 @@ {% extends "base.html" %} +{# Locale shared across all blocks below. Detected once via mkdocs-static-i18n's + reconfigure_material flag, which sets config.theme.language per build. #} +{%- set cur_lang = config.theme.language if config.theme.language in ['en', 'zh'] else 'en' -%} + {% block outdated %} -You're not viewing the latest stable version. +{%- set outdated_msg = { + 'en': ['You\'re not viewing the latest stable version.', 'Click here to go to the latest stable version.'], + 'zh': ['您当前查看的不是最新稳定版本。', '点击此处跳转到最新稳定版本。'] +} -%} +{{ outdated_msg[cur_lang][0] }} - Click here to go to the latest stable version. + {{ outdated_msg[cur_lang][1] }} {% endblock %} @@ -20,14 +28,146 @@ {% endblock %} {% block header %} + {%- set announcement = { + 'en': 'Apache Sedona 1.9.0 is out now, featuring Spark 4.1 support, proj4sedona CRS transformation, Bing Tile functions, and more!', + 'zh': 'Apache Sedona 1.9.0 已正式发布,新增 Spark 4.1 支持、proj4sedona 坐标系转换、Bing Tile 函数等众多特性!' + } -%}
- Apache Sedona 1.9.0 is out now, featuring Spark 4.1 support, proj4sedona CRS transformation, Bing Tile functions, and more! + {{ announcement[cur_lang] }}
{{ super() }} {# This renders the original header below your test bar #} {% endblock %} {% block container %} - {% if page.is_homepage %} + {% set is_home = page.is_homepage or (page.file and page.file.src_uri in ['index.md', 'index.zh.md']) %} + {% if is_home %} + {%- set i18n = { + 'en': { + 'hero_subtitle': 'Apache Sedona™ makes it easy to process spatial datasets of any scale.', + 'hero_cta': 'Get Started', + 'global_scale_title_1': 'QUERY and JOIN', + 'global_scale_title_2': 'from local to global scale', + 'typed_gps': 'GPS points', + 'typed_buildings': 'buildings', + 'typed_parcels': 'parcels', + 'typed_trips': 'trips', + 'typed_places': 'places', + 'typed_businesses': 'businesses', + 'typed_land': 'land', + 'typed_vegetation': 'vegetation', + 'typed_rasters': 'rasters', + 'typed_vectors': 'vectors', + 'typed_tabular': 'tabular tables', + 'get_started_title': 'Get started in seconds', + 'get_started_desc': 'Install SedonaDB, or run Sedona on distributed systems when you need additional scale.', + 'install_sedonadb_cta': 'Install SedonaDB', + 'deploy_title': 'Deploy Sedona where you need it', + 'deploy_desc': 'Choose the right runtime for your infrastructure, from local setups to distributed and cloud-native systems.', + 'tag_local': 'Local', + 'tag_batch': 'Batch', + 'tag_streaming': 'Streaming', + 'tag_cloud': 'Cloud', + 'sedonadb_desc': 'Standalone runtime for local processing and development.', + 'sedonaspark_desc': 'Distributed batch processing on Apache Spark clusters.', + 'sedonaflink_desc': 'Real-time spatial analytics using Apache Flink.', + 'sedonasnow_desc': 'Native spatial support inside Snowflake environments.', + 'sedona_cloud_title': 'Sedona in the Cloud', + 'sedona_cloud_desc': 'Integrated spatial support in your preferred cloud environment', + 'sedona_cloud_cta': 'Explore the ecosystem', + 'industries_title': 'Want to share your Sedona use case?', + 'industries_subtitle': 'Join our Discord or create a GitHub Discussion so we can collaborate.', + 'industry_mobility': 'Mobility', + 'industry_telecom': 'Telecom', + 'industry_data': 'Data and map production', + 'industry_logistics': 'Logistics', + 'industry_energy': 'Energy', + 'industry_finance': 'Finance', + 'features_title': 'Apache Sedona at a glance', + 'features_desc': 'Core features that define Sedona’s geospatial performance', + 'feature_scalable_title': 'Scalable', + 'feature_scalable_desc': 'Works with small or large datasets with Spark, Flink, or locally.', + 'feature_complete_title': 'Feature Complete', + 'feature_complete_desc': '300+ spatial functions, support for spatial file formats, and compatible with lakehouses and databases.', + 'feature_raster_title': 'Raster and Vector Support', + 'feature_raster_desc': 'Analyze both raster and vector datasets.', + 'feature_portable_title': 'Portable', + 'feature_portable_desc': 'Easy to run locally, in the cloud, or with any data platform.', + 'feature_fast_title': 'Fast', + 'feature_fast_desc': 'Optimized execution for single node or distributed cluster environments.', + 'feature_fast_cta': 'See the benchmarks', + 'feature_familiar_title': 'Familiar', + 'feature_familiar_desc': 'Supports many programming languages and runnable in the environment where you feel most comfortable.', + 'community_title': 'Join the community', + 'community_desc': 'Discover what our community has to say about their Apache Sedona experience.', + 'events_title': 'Monthly community meetings and programming conferences', + 'events_cta': 'Find Events', + 'events_decor_pre': 'Sedona ', + 'events_decor_strong': 'Events' + }, + 'zh': { + 'hero_subtitle': 'Apache Sedona™ 让处理任意规模的空间数据变得轻而易举。', + 'hero_cta': '立即开始', + 'global_scale_title_1': '查询与连接', + 'global_scale_title_2': '从本地到全球规模', + 'typed_gps': 'GPS 轨迹点', + 'typed_buildings': '建筑', + 'typed_parcels': '地块', + 'typed_trips': '出行', + 'typed_places': '场所', + 'typed_businesses': '商户', + 'typed_land': '土地', + 'typed_vegetation': '植被', + 'typed_rasters': '栅格', + 'typed_vectors': '矢量', + 'typed_tabular': '表格数据', + 'get_started_title': '几秒钟即可上手', + 'get_started_desc': '安装 SedonaDB,或在需要更大规模时将 Sedona 部署到分布式系统。', + 'install_sedonadb_cta': '安装 SedonaDB', + 'deploy_title': '在任何需要的地方部署 Sedona', + 'deploy_desc': '从本地环境到分布式与云原生系统,选择最适合您基础设施的运行时。', + 'tag_local': '本地', + 'tag_batch': '批处理', + 'tag_streaming': '流处理', + 'tag_cloud': '云端', + 'sedonadb_desc': '面向本地处理与开发的独立运行时。', + 'sedonaspark_desc': '在 Apache Spark 集群上的分布式批处理。', + 'sedonaflink_desc': '基于 Apache Flink 的实时空间分析。', + 'sedonasnow_desc': '在 Snowflake 环境中提供原生空间支持。', + 'sedona_cloud_title': '云端的 Sedona', + 'sedona_cloud_desc': '在您所选的云环境中集成空间能力', + 'sedona_cloud_cta': '探索生态系统', + 'industries_title': '想分享您的 Sedona 应用案例?', + 'industries_subtitle': '加入我们的 Discord,或在 GitHub Discussions 发起讨论,与我们协作。', + 'industry_mobility': '出行', + 'industry_telecom': '电信', + 'industry_data': '数据与地图生产', + 'industry_logistics': '物流', + 'industry_energy': '能源', + 'industry_finance': '金融', + 'features_title': 'Apache Sedona 概览', + 'features_desc': '定义 Sedona 地理空间性能的核心特性', + 'feature_scalable_title': '可扩展', + 'feature_scalable_desc': '可在 Spark、Flink 或本地处理小型或大型数据集。', + 'feature_complete_title': '功能完备', + 'feature_complete_desc': '300+ 空间函数,支持多种空间文件格式,并与数据湖仓和数据库兼容。', + 'feature_raster_title': '同时支持栅格与矢量', + 'feature_raster_desc': '可同时分析栅格与矢量数据集。', + 'feature_portable_title': '可移植', + 'feature_portable_desc': '易于在本地、云端或任何数据平台上运行。', + 'feature_fast_title': '高性能', + 'feature_fast_desc': '面向单节点或分布式集群环境的优化执行。', + 'feature_fast_cta': '查看基准测试', + 'feature_familiar_title': '熟悉易用', + 'feature_familiar_desc': '支持多种编程语言,可在您最熟悉的环境中使用。', + 'community_title': '加入社区', + 'community_desc': '听听社区对 Apache Sedona 使用体验的分享。', + 'events_title': '每月社区会议与技术大会', + 'events_cta': '查看活动', + 'events_decor_pre': 'Sedona ', + 'events_decor_strong': '活动' + } + } -%} + {%- set t = i18n[cur_lang] -%}
@@ -35,24 +175,24 @@
- +

Apache Sedona

- Apache Sedona™ makes it easy to process spatial datasets of any scale. + {{ t.hero_subtitle }}
- +
@@ -63,24 +203,24 @@

Apache Sedona

-
QUERY and JOIN
+
{{ t.global_scale_title_1 }}

-

GPS points

-

buildings

-

parcels

-

trips

-

places

-

businesses

-

land

-

vegetation

-

rasters

-

vectors

-

tabular tables

+

{{ t.typed_gps }}

+

{{ t.typed_buildings }}

+

{{ t.typed_parcels }}

+

{{ t.typed_trips }}

+

{{ t.typed_places }}

+

{{ t.typed_businesses }}

+

{{ t.typed_land }}

+

{{ t.typed_vegetation }}

+

{{ t.typed_rasters }}

+

{{ t.typed_vectors }}

+

{{ t.typed_tabular }}

-
from local to global scale
+
{{ t.global_scale_title_2 }}
@@ -163,15 +303,15 @@

Apache Sedona

- Get started in seconds + {{ t.get_started_title }}

- Install SedonaDB, or run Sedona on distributed systems when you need additional scale. + {{ t.get_started_desc }}
- Install SedonaDB + {{ t.install_sedonadb_cta }}
@@ -183,19 +323,19 @@

-

Deploy Sedona where you need it

-
Choose the right runtime for your infrastructure, from local setups to distributed and cloud-native systems.
+

{{ t.deploy_title }}

+
{{ t.deploy_desc }}
- +
- Local + {{ t.tag_local }}

SedonaDB

-
Standalone runtime for local processing and development.
+
{{ t.sedonadb_desc }}
SedonaDB @@ -211,13 +351,13 @@

SedonaDB

- +
- Batch + {{ t.tag_batch }}

SedonaSpark

-
Distributed batch processing on Apache Spark clusters.
+
{{ t.sedonaspark_desc }}
SedonaSpark @@ -233,13 +373,13 @@

SedonaSpark

- +
- Streaming + {{ t.tag_streaming }}

SedonaFlink

-
Real-time spatial analytics using Apache Flink.
+
{{ t.sedonaflink_desc }}
SedonaFlink @@ -255,14 +395,14 @@

SedonaFlink

- +
- Batch + {{ t.tag_batch }}

SedonaSnow

- Native spatial support inside Snowflake environments. + {{ t.sedonasnow_desc }}
@@ -279,16 +419,16 @@

SedonaSnow

- +
- Cloud + {{ t.tag_cloud }}
-

Sedona in the Cloud

-
Integrated spatial support in your preferred cloud environment
+

{{ t.sedona_cloud_title }}

+
{{ t.sedona_cloud_desc }}
- Explore the ecosystem + {{ t.sedona_cloud_cta }} @@ -309,10 +449,10 @@

Sedona in the Cloud

-

Want to share your Sedona use case?

+

{{ t.industries_title }}

- Join our Discord or create a GitHub Discussion so we can collaborate. + {{ t.industries_subtitle }}
@@ -320,22 +460,22 @@

Want to share your Sedona use case?

- Mobility + {{ t.industry_mobility }}
- Telecom + {{ t.industry_telecom }}
- Data and map production + {{ t.industry_data }}
- Logistics + {{ t.industry_logistics }}
- Energy + {{ t.industry_energy }}
- Finance + {{ t.industry_finance }}
@@ -345,63 +485,63 @@

Want to share your Sedona use case?

- +
- +
- +
- +
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -427,51 +567,51 @@

Want to share your Sedona use case?

-

Apache Sedona at a glance

-
Core features that define Sedona’s geospatial performance
+

{{ t.features_title }}

+
{{ t.features_desc }}
- +
-

Scalable

-
Works with small or large datasets with Spark, Flink, or locally.
+

{{ t.feature_scalable_title }}

+
{{ t.feature_scalable_desc }}
- +
-

Feature Complete

-
300+ spatial functions, support for spatial file formats, and compatible with lakehouses and databases.
+

{{ t.feature_complete_title }}

+
{{ t.feature_complete_desc }}
- +
-

Raster and Vector Support

-
Analyze both raster and vector datasets.
+

{{ t.feature_raster_title }}

+
{{ t.feature_raster_desc }}
- +
-

Portable

-
Easy to run locally, in the cloud, or with any data platform.
+

{{ t.feature_portable_title }}

+
{{ t.feature_portable_desc }}
- +
-

Fast

-
Optimized execution for single node or distribute cluster environments.
+

{{ t.feature_fast_title }}

+
{{ t.feature_fast_desc }}
- See the benchmarks + {{ t.feature_fast_cta }} @@ -484,10 +624,10 @@

Fast

- +
-

Familiar

-
Supports many programming languages and runnable in the environment where you feel most comfortable.
+

{{ t.feature_familiar_title }}

+
{{ t.feature_familiar_desc }}
@@ -510,8 +650,8 @@

Familiar

-

Join the community

-
Discover what our community has to say about their Apache Sedona experience.
+

{{ t.community_title }}

+
{{ t.community_desc }}
@@ -546,7 +686,7 @@

Join the community

- +
Sean Rose
@@ -560,7 +700,7 @@

Join the community

- +
Sean Rose
@@ -574,7 +714,7 @@

Join the community

- +
Sean Rose
@@ -588,7 +728,7 @@

Join the community

- +
Sean Rose
@@ -602,7 +742,7 @@

Join the community

- +
Sean Rose
@@ -627,21 +767,21 @@

Join the community

- Monthly community meetings and programming conferences + {{ t.events_title }}

- +
-
Sedona Events
-
Sedona Events
-
Sedona Events
+
{{ t.events_decor_pre }}{{ t.events_decor_strong }}
+
{{ t.events_decor_pre }}{{ t.events_decor_strong }}
+
{{ t.events_decor_pre }}{{ t.events_decor_strong }}
diff --git a/docs-overrides/partials/alternate.html b/docs-overrides/partials/alternate.html new file mode 100644 index 00000000000..e038aad5c48 --- /dev/null +++ b/docs-overrides/partials/alternate.html @@ -0,0 +1,15 @@ +{% if config.extra.alternate and config.extra.alternate | length > 1 %} +
+{% endif %} diff --git a/docs/download.zh.md b/docs/download.zh.md new file mode 100644 index 00000000000..585535de18a --- /dev/null +++ b/docs/download.zh.md @@ -0,0 +1,63 @@ + + +## GitHub 代码仓库 + +最新源代码:[GitHub 代码仓库](https://github.com/apache/sedona/) + +历史 GeoSpark 版本:[GitHub Releases](https://github.com/apache/sedona/releases) + +每次提交到 master 分支后自动构建的二进制 JAR 包:[GitHub Action](https://github.com/apache/sedona/actions/workflows/java.yml) + +## 校验完整性 + +[公钥](https://downloads.apache.org/sedona/KEYS) + +[校验说明](https://www.apache.org/info/verification.html) + +## 版本 + +### 1.9.0 + +| | 从 ASF 下载 | 校验和 | 签名 | +|:-----------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------:| +| 源代码 | [src](https://www.apache.org/dyn/closer.lua/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-src.tar.gz.asc) | +| 二进制 | [bin](https://www.apache.org/dyn/closer.lua/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.9.0/apache-sedona-1.9.0-bin.tar.gz.asc) | + +### 1.8.1 + +| | 从 ASF 下载 | 校验和 | 签名 | +|:-----------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------:| +| 源代码 | [src](https://www.apache.org/dyn/closer.lua/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-src.tar.gz.asc) | +| 二进制 | [bin](https://www.apache.org/dyn/closer.lua/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.8.1/apache-sedona-1.8.1-bin.tar.gz.asc) | + +### 1.7.2 + +| | 从 ASF 下载 | 校验和 | 签名 | +|:-----------------:|:----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------:| +| 源代码 | [src](https://www.apache.org/dyn/closer.lua/sedona/1.7.2/apache-sedona-1.7.2-src.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.7.2/apache-sedona-1.7.2-src.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.7.2/apache-sedona-1.7.2-src.tar.gz.asc) | +| 二进制 | [bin](https://www.apache.org/dyn/closer.lua/sedona/1.7.2/apache-sedona-1.7.2-bin.tar.gz) | [sha512](https://downloads.apache.org/sedona/1.7.2/apache-sedona-1.7.2-bin.tar.gz.sha512) | [asc](https://downloads.apache.org/sedona/1.7.2/apache-sedona-1.7.2-bin.tar.gz.asc) | + +### 历史版本 + +历史版本的 Sedona 已归档,可在以下位置找到:[Apache 归档](https://archive.apache.org/dist/sedona/)(1.2.1-incubating 及之后的版本)。 + +## 安全 + +如有安全相关问题,请参阅 https://www.apache.org/security/ diff --git a/docs/sedonaflink.zh.md b/docs/sedonaflink.zh.md new file mode 100644 index 00000000000..0888e4825ea --- /dev/null +++ b/docs/sedonaflink.zh.md @@ -0,0 +1,111 @@ + + +# SedonaFlink + +SedonaFlink 将地理空间函数集成到 Apache Flink 中,是构建依赖地理空间数据的流式管道的理想选择。 + +以下是 SedonaFlink 的一些典型应用场景: + +* 从 Kafka 读取地理空间数据并写入 Iceberg +* [实时分析交通密度](https://www.alibabacloud.com/help/en/flink/realtime-flink/use-cases/analyze-traffic-density-with-flink-and-apache-sedona) +* 电信行业的实时网络规划与优化 + +下面是一些示例代码片段: + +=== "Java" + + ```java + sedona.createTemporaryView("myTable", tbl) + Table geomTbl = sedona.sqlQuery("SELECT ST_GeomFromWKT(geom_polygon) as geom_polygon, name_polygon FROM myTable") + geomTbl.execute().print() + ``` + +=== "PyFlink" + + ```python + table_env.sql_query("SELECT ST_ASBinary(ST_Point(1.0, 2.0))").execute().collect() + ``` + +## 主要特性 + +* **实时地理空间流处理**,满足低延迟处理需求。 +* **可扩展**,适用于大规模流式管道。 +* 基于 Flink 的时间窗口实现**事件时间处理**。 +* 提供**精确一次(Exactly Once)**处理保证。 +* **可移植**,易于在任何 Flink 运行时中部署。 +* **开源**,遵循 Apache 软件基金会的准则进行管理。 + +## 为什么在 Flink 上使用 Sedona? + +Flink 是为流式数据而设计的,Sedona 在此基础上为其加入了地理空间处理能力。 + +大多数地理空间处理发生在 Spark 或 PostGIS 这类批处理系统中,对于延迟要求不高的场景这没有问题。 + +而当需要实时处理地理空间数据时,Sedona on Flink 的优势就会显现出来。 + +Flink 可以为地理空间查询提供毫秒级的延迟。 + +Flink 拥有完善的容错机制,即使在故障发生时,地理空间管道也不会丢失数据。 + +Sedona on Flink 可以在 Flink 支持的任何环境中运行,包括 Kubernetes、YARN 以及独立集群。 + +## 工作原理 + +Sedona 直接集成到 Flink 的 Table API 和 SQL 引擎中。 + +在搭建 Flink 环境时注册 Sedona 的空间函数,即可在 SQL 查询中使用 `ST_Point`、`ST_Contains`、`ST_Distance` 等函数。 + +Sedona 同时支持 Flink 的 DataStream API 与 Table API,可根据自身工作流程选用。 + +空间运算作为 Flink 分布式执行的一部分运行,因此地理空间计算会自动在集群中并行执行。 + +Sedona 在 Flink 内部以二进制方式存储几何对象,从而保持较低的内存占用与较高的处理速度。 + +执行空间连接时,Sedona 在底层使用空间索引,使查询能够快速完成。 + +容错由 Flink 的检查点(checkpoint)机制处理。如果某个节点崩溃,地理空间状态可以从最近一次检查点恢复。 + +通常的流程是:从 Kafka 或文件系统等数据源读取地理空间数据,使用 Sedona 的空间函数进行处理,然后将结果写入 Iceberg 等数据汇。 + +整条 SedonaFlink 管道持续运行,新事件会实时流过空间转换逻辑。 + +## 与其他方案的对比 + +对于较小的数据集,可能并不需要分布式集群,使用 SedonaDB 即可。 + +对于大规模批处理管道,可以使用 SedonaSpark。 + +下面是 SedonaFlink 与几种流式方案的直接对比。 + +**SedonaFlink 与 Sedona on Spark Structured Streaming** + +Spark Streaming 采用微批(micro-batch)模式,而 Flink 是逐事件处理。在某些工作流中,这能让 Flink 的延迟更低。 + +Flink 的状态管理也更为成熟。 + +如果已经深度使用 Spark 生态,且 Spark Structured Streaming 的延迟可以满足需求,可以选择 Spark;如果对延迟有非常严苛的要求,建议选择 Flink。 + +**Sedona on Flink 与 PostGIS** + +PostGIS 非常适合用于 OLTP 工作负载下的地理空间数据存储与查询,但它并不是为流式处理而设计的。 + +如果使用 PostGIS 处理流式工作负载,需要持续从流处理器中查询数据库,这会增加延迟,并对数据库造成压力。 + +SedonaFlink 在数据流转过程中即对地理空间数据进行处理,从而避免了与数据库之间的往返开销。 diff --git a/docs/sedonasnow.zh.md b/docs/sedonasnow.zh.md new file mode 100644 index 00000000000..fbaa56f5ea8 --- /dev/null +++ b/docs/sedonasnow.zh.md @@ -0,0 +1,55 @@ + + +# SedonaSnow + +SedonaSnow 将 Apache Sedona 的 200 多个地理空间函数直接引入到 Snowflake 环境中,作为 Snowflake 原生空间函数的有力补充。 + +## 主要优势 + +* **200+ 空间函数**:例如 3D 距离、几何对象校验、精度归约等 +* **高性能空间连接**:Sedona 针对空间连接做了专门优化 +* **无缝集成**:与 Snowflake 原生函数协同工作 +* **数据无需移动**:所有处理都在 Snowflake 内部完成 + +## 快速上手 + +下面是一个使用 SedonaSnow 在 Snowflake 表上执行查询的示例。 + +```sql +USE DATABASE SEDONASNOW; + +SELECT SEDONA.ST_GeomFromWKT(wkt) AS geom +FROM your_table; + +SELECT SEDONA.ST_3DDistance(geom1, geom2) FROM spatial_data; +``` + +下面是一个空间连接的示例: + +```sql +SELECT * FROM lefts, rights +WHERE lefts.cellId = rights.cellId; +``` + +可以看出,SedonaSnow 能够无缝地接入现有的 Snowflake 环境。 + +## 后续步骤 + +如果您正在 Snowflake 中进行严肃的空间分析工作,SedonaSnow 是一个非常合适的选择。它运行速度快,并提供了丰富的空间函数。SedonaSnow 在不需要将数据迁移到其他平台的前提下,突破了 Snowflake 内置空间函数的能力限制。 diff --git a/docs/sedonaspark.zh.md b/docs/sedonaspark.zh.md new file mode 100644 index 00000000000..cb3db6198ec --- /dev/null +++ b/docs/sedonaspark.zh.md @@ -0,0 +1,135 @@ + + +# SedonaSpark + +SedonaSpark 在 Apache Spark 之上扩展了一套丰富、开箱即用的分布式空间数据集和函数,能够在多台机器之间高效地加载、处理和分析大规模空间数据。当数据集规模超过单机处理能力时,SedonaSpark 是一个非常合适的选择。 + +=== "SQL" + + ```sql + SELECT superhero.name + FROM city, superhero + WHERE ST_Contains(city.geom, superhero.geom) + AND city.name = 'Gotham' + ``` + +=== "PySpark" + + ```python + sedona.sql(""" + SELECT superhero.name + FROM city, superhero + WHERE ST_Contains(city.geom, superhero.geom) + AND city.name = 'Gotham' + """) + ``` + +=== "Java" + + ```java + Dataset result = spark.sql( + "SELECT superhero.name " + + "FROM city, superhero " + + "WHERE ST_Contains(city.geom, superhero.geom) " + + "AND city.name = 'Gotham'" + ); + ``` + +=== "Scala" + + ```scala + sedona.sql(""" + SELECT superhero.name + FROM city, superhero + WHERE ST_Contains(city.geom, superhero.geom) + AND city.name = 'Gotham' + """) + ``` + +=== "R" + + ```r + result <- sql(" + SELECT superhero.name + FROM city, superhero + WHERE ST_Contains(city.geom, superhero.geom) + AND city.name = 'Gotham' + ") + ``` + +## 主要特性 + +* **极致性能**:SedonaSpark 在集群中的多个节点上并行执行计算,使大规模计算能够快速完成。 +* 支持**多种文件格式**,包括 GeoJSON、Shapefile、GeoParquet、STAC、JDBC、OSM PBF、CSV 和 PostGIS。 +* 提供多种**语言 API**,包括 SQL、Python、Java、Scala 和 R。 +* **可扩展**:可根据数据规模水平扩展到数十、数百乃至数千个节点,使用 SedonaSpark 处理海量空间数据集。 +* **可移植**:易于在自定义环境中运行,可在本地或云端(如 AWS EMR、Microsoft Fabric、Google DataProc)部署。 +* **可扩展定制**:可以使用自定义逻辑对 SedonaSpark 进行扩展,以满足特定的地理空间数据分析需求。 +* **开源**:Apache Sedona 是一个开源项目,遵循 Apache 软件基金会的相关准则进行管理。 +* 提供更多扩展能力,例如 [最近邻搜索](https://sedona.apache.org/latest/api/sql/NearestNeighbourSearching/) 以及诸如 [DBSCAN](https://sedona.apache.org/latest/tutorial/sql/#cluster-with-dbscan) 等空间统计算法。 + +## 可移植性 + +SedonaSpark 易于在本地、Docker 中或主流云平台上运行。 + +SedonaSpark 设计为可在任何能运行 Spark 的环境中运行。许多云厂商都提供 Spark 运行时,Sedona 可以作为依赖库添加进去。 + +在本地运行 Sedona 也很方便,可以在将代码部署到生产数据集之前快速迭代。 + +## 使用 Spark 和 Sedona 处理矢量数据的示例 + +下面看一下如何使用 Spark 和 Sedona 在矢量数据集上完成一次完整的工作流程。 + +我们使用 Overture Maps Foundation 提供的基础水体数据,将纽约市地区的所有水体绘制到地图上。首先读取数据并创建视图: + +``` +base_water = sedona.table("open_data.overture_maps_foundation.base_water") +base_water.createOrReplaceTempView("base_water_view") +``` + +然后过滤出纽约市地区范围内的水体: + +```python +spot = "POLYGON ((-74.174194 40.509623, -73.635864 40.509623, -73.635864 40.93634, -74.174194 40.93634, -74.174194 40.509623))" +query = f""" +select id, geometry from base_water_view +where ST_Contains(ST_GeomFromWKT('{spot}'), geometry) +""" +res = sedona.sql(query) +``` + +Sedona 与主流的可视化库无缝集成,可以轻松地从 Sedona DataFrame 创建地图。仅需两行代码即可生成一张地图: + +```python +kepler_map = SedonaKepler.create_map() +SedonaKepler.add_df(kepler_map, df=res, name="Tri-state water") +``` + +地图效果非常出色! + +![New York City water](image/nyc_base_water.png) + +通过这张地图,可以清晰地看到纽约市地区的所有河流、湖泊乃至游泳池。 + +## 有疑问? + +欢迎在 GitHub Discussions 发起讨论,或者加入 Discord 社区向开发者提问。 + +我们期待与您协作!