最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

马上搞懂 GeoJSON

XAMPP案例 admin 1509浏览 0评论

用于描述地理空间信息的数据格式,语法是基于 JSON 格式的。

每一个 GeoJSON 对象都有一个 type 属性:

Point:点
MultiPoint:多点
LineString:线
MultiLineString:多线
Polygon:面
MultiPolygon:多面
GeometryCollection:几何体集合
Feature:特征
FeatureCollection:特征集合
分类
type:Point、MultiPoint、LineString、MultiLineString、Polygon、MultiPolygon

则该对象必须有属性 coordinates,这类对象称为几何对象。

// 点对象
{
‘type’: ‘Point’,
‘coordinates’: [-105, 39]
}
// 线对象
{
‘type’: ‘LineString’,
‘coordinates’: [[-105, 39], [-107, 38]]
}
// 面对象
{
‘type’: ‘Polygon’,
‘coordinates’: [
[[30, 0], [31, 0], [31, 5], [30, 5], [30, 0]]
]
}
type:GeometryCollection

则该对象必须有属性 geometries,其值是一个数组,每一项都是一个 GeoJSON 的几何对象。

{
‘type’: ‘GeometryCollection’,
‘geometries’: [
{
‘type’: ‘Point’,
‘coordinates’: [100, 40]
},
{
‘type’: ‘LineString’,
‘coordinates’: [[100, 30], [100, 35]]
}
]
}
type:Feature

则该对象必须有属性 geometry,其值为一个几何对象;此外还有一个属性 properties,可以是任意 JSON 或 null

{
‘type’: ‘Feature’,
‘properties’: {
‘name’: ‘北京’
},
‘geometry’: {
‘type’: ‘Point’,
‘coordinates’: [116.3671875, 39.977120098439634]
}
}
type:FeatureCollection

则该对象必须有属性 features,其值为一个数组,每一项都是一个 Feature 对象。

{
‘type’: ‘FeatureCollection’,
‘features’: [
{
‘type’: …,
‘properties’: …,
‘geometry’: …
},

]
}

转载请注明:XAMPP中文组官网 » 马上搞懂 GeoJSON

您必须 登录 才能发表评论!