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应用程序中的地理数据展示和交互。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值