当前位置: 首页 > news >正文

GeoJSON 介绍

文章目录

  • GeoJSON 介绍
    • 1. GeoJSON 基本概念
    • 2. GeoJSON 格式结构
    • 3. 支持的几何类型
      • Point 点
      • LineString 线
      • Polygon 多边形
      • MultiPoint 多点
      • MultiLineString 多线
      • MultiPolygon 多面
      • GeometryCollection 几何集合
    • 4. 使用场景
    • 5. 库支持

GeoJSON 介绍

  • GeoJSON 官网:https://geojson.org/
    提供 GeoJSON 的规范说明、RFC 7946 标准文档及相关资源79。

  • GeoJSON 在线编辑器:http://geojson.io/
    可在线编辑、预览 GeoJSON 数据。

1. GeoJSON 基本概念

GeoJSON 是一种用于对各种地理数据结构进行编码的格式。

GeoJSON 支持以下几何类型:

  • 点 (Point)
  • 线 (LineString)
  • 面 (Polygon)
  • 多点 (MultiPoint)
  • 多线 (MultiLineString)
  • 多面 (MultiPolygon)
  • 几何集合 (GeometryCollection)

具有附加属性的几何对象是 Feature 对象。要素集包含在对象中 FeatureCollection 。

GeoJSON 默认使用 WGS84 坐标系(经度, 纬度)

2. GeoJSON 格式结构

一个基本的 GeoJSON 对象结构如下:

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

主要组成部分:

  • type - 标识 GeoJSON 对象的类型
    • 可以是 “FeatureCollection”, “Feature”, 或几何类型之一
  • features (仅 FeatureCollection 有) - 包含一组 Feature 对象
  • geometry (仅 Feature 有) - 包含几何对象及其坐标
  • properties (仅 Feature 有) - 包含与几何相关的属性数据

3. 支持的几何类型

Point 点

{"type": "Feature","geometry": {"type": "Point","coordinates": [118.08804372425419, 24.48401512708469]},"properties": {"name": "Example Point"}
}

LineString 线

{"type": "Feature","geometry": {"type": "LineString","coordinates": [[118.08804372425419, 24.48401512708469],[121.44534340242714, 24.108833181868842]]},"properties": {"name": "Example LineString"}
}

Polygon 多边形

{"type": "Feature","geometry": {"type": "Polygon","coordinates": [[[115.56769883631596, 26.796759291820862],[120.24743143329276, 27.994531040608],[119.96279402305146, 20.845962507158415],[110.42921794452593, 21.9891800116634]]]},"properties": {"name": "Example Polygon"}
}

MultiPoint 多点

{"type": "Feature","geometry": {"type": "MultiPoint","coordinates": [[115.56769883631596, 26.796759291820862],[120.24743143329276, 27.994531040608],[119.96279402305146, 20.845962507158415],[110.42921794452593, 21.9891800116634]]},"properties": {"name": "Example MultiPoint"}
}

MultiLineString 多线

{"type": "Feature","geometry": {"type": "MultiLineString","coordinates": [[[115.56769883631596, 26.796759291820862],[120.24743143329276, 27.994531040608]],[[119.96279402305146, 20.845962507158415],[110.42921794452593, 21.9891800116634]]]},"properties": {"name": "Example MultiLineString"}
}

MultiPolygon 多面

{"type": "Feature","geometry": {"type": "MultiPolygon","coordinates": [[[[115.56769883631596, 26.796759291820862],[120.24743143329276, 27.994531040608],[119.96279402305146, 20.845962507158415],[110.42921794452593, 21.9891800116634]]],[[[119.96279402305146, 20.845962507158415],[110.42921794452593, 21.9891800116634],[111.1013749119565, 18.845558689105033],[121.21864864334037, 18.696822467873176]]]]},"properties": {"name": "Example MultiPolygon"}
}

GeometryCollection 几何集合

{"type": "FeatureCollection","features": [{"type": "Feature","geometry": {"type": "Point","coordinates": [102.0, 0.5]},"properties": {"name": "Example Point"}},{"type": "Feature","geometry": {"type": "LineString","coordinates": [[118.08804372425419, 24.48401512708469],[121.44534340242714, 24.108833181868842]]},"properties": {"name": "Example LineString"}}]
}

4. 使用场景

  • Web 地图应用(Cesium, Mapbox GL JS 等)
  • 地理空间数据交换
  • 服务器与客户端之间的地理数据传输
  • 地理空间数据库导出/导入

5. 库支持

  • JavaScript:Turf.js
http://www.dtcms.com/a/324612.html

相关文章:

  • 大模型时代的机器人研究趋势:从多模态融合到高效迁移
  • 【C++/STL】list模拟实现和迭代器失效问题
  • Spring Boot配置文件加密详解
  • 6.AD环境中的安全威胁与防护措施全性
  • java报错“ NoSuchMethodError:com.test.Service.doRoomList(Ljava/lang/String;)V解决方案
  • 红黑树及其简单实现
  • XGBoost参数说明和详解
  • Suno API V5 全面升级——多语言接入,开启 AI 音乐创作新时代
  • 计算机网络:路由聚合的注意事项有哪些?
  • vue3前端项目cursor rule
  • ARM保留的标准中断处理程序入口和外设中断处理程序入口介绍
  • 【Jenkins入门以及安装】
  • SQL176 每个题目和每份试卷被作答的人数和次数
  • 力扣(H指数)
  • Mysql 8.0 新特性
  • 以太网相关协议
  • C/C++数据结构之双向链表
  • scala 样例类
  • Spring的三层架构及其各个层用到注解详细解释。
  • 零基础学Java第三讲---运算符
  • android 使用openimagelib OpenImage 实现点击放大图片,浏览
  • 【Docker实战】Spring Boot应用容器化
  • 蓝牙认证流程:BQB 测试、互操作性验证与品牌授权指南 —— 面试高频考点与历年真题解
  • Bean的实例化方式
  • WinForm之TreeView控件
  • 深入解析React Diff 算法
  • 基于 InfluxDB 的服务器性能监控系统实战(三)
  • Windchill 11.0使用枚举类型自定义实用程序实现角色管理
  • Web API开发中的数据传输:MIME类型配置与编码最佳实践
  • vulnhub-Doubletrouble靶机