登峰造极境

  • WIN
    • CSharp
    • JAVA
    • OAM
    • DirectX
    • Emgucv
  • UNIX
    • FFmpeg
    • QT
    • Python
    • Opencv
    • Openwrt
    • Twisted
    • Design Patterns
    • Mysql
    • Mycat
    • MariaDB
    • Make
    • OAM
    • Supervisor
    • Nginx
    • KVM
    • Docker
    • OpenStack
  • WEB
    • ASP
    • Node.js
    • PHP
    • Directadmin
    • Openssl
    • Regex
  • APP
    • Android
  • AI
    • Algorithm
    • Deep Learning
    • Machine Learning
  • IOT
    • Device
    • MSP430
  • DIY
    • Algorithm
    • Design Patterns
    • MATH
    • X98 AIR 3G
    • Tucao
    • fun
  • LIFE
    • 美食
    • 关于我
  • LINKS
  • ME
Claves
长风破浪会有时,直挂云帆济沧海
  1. 首页
  2. Platforms
  3. WEB
  4. GIS
  5. 正文

geojson格式介绍

2024-09-02

一、介绍

GeoJSON 是一种用于表示地理数据的格式,基于 JSON(JavaScript Object Notation)。GeoJSON 支持多种几何对象类型,以及用于描述这些几何对象的特征和集合。

Geometry Objects(几何对象)

  • Point
  • MultiPoint
  • LineString
  • MultiLineString
  • Polygon
  • MultiPolygon
  • GeometryCollection

Feature Objects(特征对象)

  • Feature特征-标识带有属性的几何对象。一个特征对象包含一个几何对象和一个属性对象。

FeatureCollection Objects(特征集合对象)

  • FeatureCollection(特征集合):表示一组特征对象的集合。

二、具体格式

Point

{
  "type": "Point",
  "coordinates": [30.0, 10.0]
}

MultiPoint

{
  "type": "MultiPoint",
  "coordinates": [
    [10.0, 40.0],
    [40.0, 30.0],
    [20.0, 20.0],
    [30.0, 10.0]
  ]
}

LineString

{
  "type": "LineString",
  "coordinates": [
    [30.0, 10.0],
    [10.0, 30.0],
    [40.0, 40.0]
  ]
}

MultiLineString

{
  "type": "MultiLineString",
  "coordinates": [
    [
      [10.0, 10.0],
      [20.0, 20.0],
      [10.0, 40.0]
    ],
    [
      [40.0, 40.0],
      [30.0, 30.0],
      [40.0, 20.0],
      [30.0, 10.0]
    ]
  ]
}

Polygon

Polygon用于表示单个多边形。它由一个外环和可选的内环(洞)组成。每个环都是一个线性环(Linear Ring),即一个闭合的线串。外环必须是第一个数组。内环(洞)是可选的,可以有多个。

格式如下:

{
  "type": "Polygon",
  "coordinates": [
    [
      [x1, y1], [x2, y2], [x3, y3], ..., [x1, y1]  // 外环坐标
    ],
    [
      [x4, y4], [x5, y5], [x6, y6], ..., [x4, y4]  // 内环坐标(可选)
    ]
  ]
}
{
  "type": "Polygon",
  "coordinates": [
    [
      [30.0, 10.0],
      [40.0, 40.0],
      [20.0, 40.0],
      [10.0, 20.0],
      [30.0, 10.0]
    ]
  ]
}

MultiPolygon

每个多边形都有自己的外环和内环(如果有的话)。多边形之间是独立的,可以有多个多边形。

{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [30.0, 20.0],
        [45.0, 40.0],
        [10.0, 40.0],
        [30.0, 20.0]
      ]
    ],
    [
      [
        [15.0, 5.0],
        [40.0, 10.0],
        [10.0, 20.0],
        [5.0, 10.0],
        [15.0, 5.0]
      ]
    ]
  ]
}

GeometryCollection

{
  "type": "GeometryCollection",
  "geometries": [
    {
      "type": "Point",
      "coordinates": [40.0, 10.0]
    },
    {
      "type": "LineString",
      "coordinates": [
        [10.0, 10.0],
        [20.0, 20.0],
        [10.0, 40.0]
      ]
    }
  ]
}

Feature

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [30.0, 10.0]
  },
  "properties": {
    "name": "Example Point"
  }
}

FeatureCollection

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
标签: 暂无
最后更新:2024-09-02

代号山岳

知之为知之 不知为不知

点赞
< 上一篇
下一篇 >

COPYRIGHT © 2099 登峰造极境. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

蜀ICP备14031139号-5

川公网安备51012202000587号