{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 数据存储格式\n", "\n", "## 向量量数据文件格式\n", "\n", "### GeoJSON\n", "\n", "GeoJSON 是一种开放的标准格式,设计用于表示简单的地理特征及其非空间属性。它基于 JSON 格式。这些特性包括点、线字符串、多边形和这些类型的多部分集合。它的主要优点之一是人类可读,并将所有相关数据存储在单个文本文件中。然而,当存储复杂的几何图形时,这些文件可能会变得非常大。\n", "\n", "下面是 FeatureCollection 的简单例子,它包含了点、线和多边形 `geometry`,并将一些属性存储为 `properties`:\n", "\n", "```json\n", " { \"type\": \"FeatureCollection\",\n", " \"features\": [\n", " { \"type\": \"Feature\",\n", " \"geometry\": {\"type\": \"Point\", \"coordinates\": [102.0, 0.5]},\n", " \"properties\": {\"prop0\": \"value0\"}\n", " },\n", " { \"type\": \"Feature\",\n", " \"geometry\": {\n", " \"type\": \"LineString\",\n", " \"coordinates\": [\n", " [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]\n", " ]\n", " },\n", " \"properties\": {\n", " \"prop0\": \"value0\",\n", " \"prop1\": 0.0\n", " }\n", " },\n", " { \"type\": \"Feature\",\n", " \"geometry\": {\n", " \"type\": \"Polygon\",\n", " \"coordinates\": [\n", " [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],\n", " [100.0, 1.0], [100.0, 0.0] ]\n", " ]\n", " },\n", " \"properties\": {\n", " \"prop0\": \"value0\",\n", " \"prop1\": {\"this\": \"that\"}\n", " }\n", " }\n", " ]\n", " }\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### GeoPackage\n", "\n", "这是一种相对较新的数据格式,遵循[开放格式标准](https://en.wikipedia.org/wiki/Open_format)(即它是非专有的)。它构建在 SQLite(自包含的关系数据库)之上。它比许多其他矢量格式的一大优势是它的紧凑性——坐标值、元数据、属性表、投影信息等等,都存储在单一的文件中,这有利于可移植性。它的文件名通常以 `.gpkg` 结尾。QGIS(2.12 及以上版本)、R 和 ArcGIS 等应用程序将识别这种格式(ArcGIS 10.2.2 及以上版本将从 ArcCatalog 读取文件,但需要脚本来创建 GeoPackage)。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Shapefile\n", "\n", "**shapefile** 是 ArcView 3.x 软件原生的基于文件的数据格式(ArcMap 的较老版本)。从概念上讲,[shapefile](https://pygis.io/docs/c_store_features.html#shapefile) 是特征类,它存储了具有相同几何类型(点、线或多边形)、相同属性和公共空间范围的特征集合。\n", "\n", "### File Geodatabase\n", "\n", "[文件地理数据库](https://pygis.io/docs/c_store_features.html#file-geodatabase) 是一种关系数据库存储格式。它的数据结构比 shapefile 复杂得多,由一个包含数十个文件的 `.gdb` 文件夹组成。它的复杂性使它更通用,允许它存储多个特征类和支持拓扑定义(即允许用户定义规则,控制不同特征类之间的关联方式)。\n", "\n", "## 光栅数据文件格式\n", "\n", "光栅部分是由它们的像素深度定义的。像素深度定义了栅格可以存储的不同值的范围。例如,$1$ 位光栅只能存储两个不同的值:$0$ 和 $1$。" ] } ], "metadata": { "language_info": { "name": "python" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }