欢迎光临
我们一直在努力

GeoJSON(GeoJSON 概述、GeoJSON 格式、GeoJSON 类型)

一、GeoJSON 概述

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


二、GeoJSON 格式

  • 一个典型的 GeoJSON 数据块如下
  • 最外层是一个 FeatureCollection,即,要素集合

  • geometry:描述在哪儿、长啥样,即,是点、线还是面

  • properties:描述是什么,即,名字、地址、长度等额外属性

  • {
    "type": "FeatureCollection",
    "features": [
    {
    "type": "Feature",
    "geometry": {
    "type": "Point",
    "coordinates": [116.40, 39.90]
    },
    "properties": {
    "name": "故宫博物院",
    "address": "北京市…"
    }
    },
    {
    "type": "Feature",
    "geometry": {
    "type": "LineString",
    "coordinates": [[116.40, 39.90], [116.50, 39.95]]
    },
    "properties": {
    "name": "景山前街",
    "width": 20
    }
    }
    ]
    }


    三、GeoJSON 类型

  • 点:表示一个具体的坐标位置,例如,一栋房子、一个路灯、手机此刻的位置
  • { "type": "Point", "coordinates": [116.40, 39.90] }

  • 线:由一串点连接而成,例如,一条道路、一条河流、公交车的行驶路线
  • { "type": "LineString", "coordinates": [[116.40, 39.90], [116.41, 39.91], [116.42, 39.92]] }

  • 面:由闭合的线围成的区域,例如,一个公园、一个小区
  • { "type": "Polygon", "coordinates": [ [ [116.40, 39.90], [116.41, 39.91], [116.42, 39.90], [116.40, 39.90] ] ] }

  • 多点
  • {
    "type": "Feature",
    "geometry": {
    "type": "MultiPoint",
    "coordinates": [
    [105.380859375,31.57853542647338],
    [105.580859375,31.52853542647338]
    ]
    }
    }

  • 多线
  • {
    "geometry":{
    "type":"LineString",
    "coordinates":[
    [
    [105.6005859375,30.65681556429287],
    [107.95166015624999,31.98944183792288],
    [109.3798828125,30.031055426540206],
    [107.7978515625,29.935895213372444]
    ],
    [
    [109.3798828125,30.031055426540206],
    [107.1978515625,31.235895213372444]
    ]
    ]
    }
    }

  • 多面
  • {
    "geometry": {
    "type": "MultiPolygon",
    "coordinates":[
    [
    [
    [109.2041015625,30.088107753367257],
    [115.02685546875,30.088107753367257],
    [115.02685546875,32.7872745269555],
    [109.2041015625,32.7872745269555],
    [109.2041015625,30.088107753367257]
    ]
    ],
    [
    [
    [112.9833984375,26.82407078047018],
    [116.69677734375,26.82407078047018],
    [116.69677734375,29.036960648558267],
    [112.9833984375,29.036960648558267],
    [112.9833984375,26.82407078047018]
    ]
    ]
    ]
    }
    }

    赞(0)
    未经允许不得转载:171主机测评 » GeoJSON(GeoJSON 概述、GeoJSON 格式、GeoJSON 类型)
    分享到: 更多 (0)

    评论 抢沙发

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址