OpenLayer4——GeoJSON简介

GeoJSON实际上就是一个JSON,为了满足GIS编程需要,额外定制了这样一套规则。
geojson中包含了点、线、面的数据,包含大量的坐标的数组

(不需要背诵记忆,如果参与GIS编程,短时间内就会接触大量这样的数据)

gsojson样例1

独立的feature

{"type":"Feature",
    "properties":{},
    "geometry":{
        "type":"Point",
        "coordinates":[105.380859375,31.57853542647338]
    }
}

gsojson样例2

feature集合

复制代码
{
    "type": "FeatureCollection",
    "features": [{
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [102.0, 0.5]
            },
            "properties": {
                "prop0": "value0"
            }
        }, {
            "type": "Feature",
            "geometry": {
                "type": "LineString",
                "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]
            },
            "properties": {
                "prop0": "value0",
                "prop1": 0.0
            }
        }
    ]
}
复制代码

GeoJSON成员变量

完整的GeoJSON,最外层往往是Feature或者FeatureCollection,Feature包含一个或多个Geometry,Geometry下面则是具体的几何数据(坐标数组和数据类型)。

GeoJSON

type:值必须是这些值其中一个:"Point","MultiPoint","LineString", "MultiLineString", "Polygon","MultiPolygon","GeometryCollection","Feature" 或者 "FeatureCollection”。

properties:携带参数,用于辅助图形绘制,并没有内容限制。(常见的比如:图形的名称、地图的样式)。

 

Geometry(几何图形,点、线、面图形数据)

Type:图形类型,分为Point、MultiPoint、LineString、MultiLineString、Polygon、MultiPolygon、GeometryCollection。

Coordinates:地图坐标数组

 

英文介绍

The GeoJSON object may have any number of members (name/value pairs).

The GeoJSON object must have a member with the name "type". This member's

value is a string that determines the type of the GeoJSON object.

The value of the type member must be one of: "Point", "MultiPoint",

"LineString", "MultiLineString", "Polygon", "MultiPolygon",

"GeometryCollection", "Feature", or "FeatureCollection". The case of the type

member values must be as shown here.

A GeoJSON object may have an optional "crs" member, the value of which must

be a coordinate reference system object .

A GeoJSON object may have a "bbox" member, the value of which must be a

bounding box array.

 

A geometry is a GeoJSON object where the type member's value is one of the

following strings: "Point", "MultiPoint", "LineString", "MultiLineString",

"Polygon", "MultiPolygon", or "GeometryCollection".

A GeoJSON geometry object of any type other than "GeometryCollection" must have

a member with the name "coordinates". The value of the coordinates member is

always an array. The structure for the elements in this array is determined by

the type of geometry.

 

posted on   疯狂的妞妞  阅读(332)  评论(0编辑  收藏  举报

(评论功能已被禁用)
相关博文:
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
历史上的今天:
2018-03-28 Shiro(一)——极简配置
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示