geojson的数据格式是什么

gpt-4o

GeoJSON是一种基于JSON(JavaScript Object Notation)的格式,用于编码地理数据。它被广泛应用于地理信息系统(GIS)和Web地图应用程序中。GeoJSON支持各种地理数据类型,包括点(Point)、线(LineString)、面(Polygon)以及这些类型的集合。以下是对GeoJSON格式的详细说明:
主要结构

FeatureCollection

这是GeoJSON的顶级对象,包含一组地理要素(Feature)。

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "name": "Example Point"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [102.0, 0.0],
          [103.0, 1.0],
          [104.0, 0.0],
          [105.0, 1.0]
        ]
      },
      "properties": {
        "name": "Example LineString"
      }
    }
  ]
}

Feature

表示一个地理要素,包含几何数据和属性数据。

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [102.0, 0.5]
  },
  "properties": {
    "name": "Example Point"
  }
}

Geometry

表示地理形状。支持以下几何类型:

  • Point: 一个点
  • LineString: 一条线
  • Polygon: 一个面
  • MultiPoint: 多个点
  • MultiLineString: 多条线
  • MultiPolygon: 多个面
  • GeometryCollection: 一个几何对象集合

Point

{
  "type": "Point",
  "coordinates": [102.0, 0.5]
}

LineString

{
  "type": "LineString",
  "coordinates": [
    [102.0, 0.0],
    [103.0, 1.0],
    [104.0, 0.0],
    [105.0, 1.0]
  ]
}

Polygon

{
  "type": "Polygon",
  "coordinates": [
    [
      [100.0, 0.0],
      [101.0, 0.0],
      [101.0, 1.0],
      [100.0, 1.0],
      [100.0, 0.0]
    ]
  ]
}

MultiPoint

{
  "type": "MultiPoint",
  "coordinates": [
    [100.0, 0.0],
    [101.0, 1.0]
  ]
}

MultiLineString

{
  "type": "MultiLineString",
  "coordinates": [
    [
      [100.0, 0.0],
      [101.0, 1.0]
    ],
    [
      [102.0, 2.0],
      [103.0, 3.0]
    ]
  ]
}

MultiPolygon

{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [102.0, 2.0],
        [103.0, 2.0],
        [103.0, 3.0],
        [102.0, 3.0],
        [102.0, 2.0]
      ]
    ],
    [
      [
        [100.0, 0.0],
        [101.0, 0.0],
        [101.0, 1.0],
        [100.0, 1.0],
        [100.0, 0.0]
      ]
    ]
  ]
}

GeometryCollection

{
  "type": "GeometryCollection",
  "geometries": [
    {
      "type": "Point",
      "coordinates": [100.0, 0.0]
    },
    {
      "type": "LineString",
      "coordinates": [
        [101.0, 0.0],
        [102.0, 1.0]
      ]
    }
  ]
}

属性数据
每个Feature对象可以包含一个properties对象,用于存储与几何对象相关的属性数据。

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [102.0, 0.5]
  },
  "properties": {
    "name": "Example Point",
    "description": "This is an example point."
  }
}

以上是GeoJSON格式的详细说明。它结构简单、易于阅读和解析,特别适用于Web应用程序中的地理数据展示和交互。

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-17 23:56:03       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-17 23:56:03       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-17 23:56:03       58 阅读
  4. Python语言-面向对象

    2024-07-17 23:56:03       69 阅读

热门阅读

  1. 深入解析JVM内存模型:面试题及详细解答

    2024-07-17 23:56:03       19 阅读
  2. C# 3.数组遍历和储存对象

    2024-07-17 23:56:03       22 阅读
  3. c++初阶知识——类和对象(下)

    2024-07-17 23:56:03       25 阅读
  4. 【Rust】使用日志记录利器flexi_logger

    2024-07-17 23:56:03       18 阅读
  5. Python之爬虫基础

    2024-07-17 23:56:03       19 阅读
  6. C语言12 宏定义、内存

    2024-07-17 23:56:03       21 阅读
  7. 使用Python进行车牌识别

    2024-07-17 23:56:03       21 阅读
  8. Android11 设置一个默认密码 万能密码

    2024-07-17 23:56:03       19 阅读
  9. github.com/antchfx/jsonquery基本使用

    2024-07-17 23:56:03       20 阅读
  10. 初学Python必须知道的14个强大单行代码

    2024-07-17 23:56:03       21 阅读