GeoJSON

GeoJson简介

Link

Demo of the above picture(其实就三种,Point,LineString,Polygon)
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          31.008774502552114,
          30.57401986098897
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          [
            31.270642681067756,
            30.70475805458352
          ],
          [
            31.50662704823486,
            30.579570269245494
          ],
          [
            31.36114832114751,
            30.45424303674909
          ],
          [
            31.23830259353008,
            30.546162991831196
          ],
          [
            31.260943856312508,
            30.70475805458352
          ]
        ],
        "type": "LineString"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          [
            [
              31.112224083605412,
              30.27293489657916
            ],
            [
              31.286793597398372,
              29.760685614756298
            ],
            [
              31.542010212780866,
              30.236591437150153
            ],
            [
              31.112224083605412,
              30.27293489657916
            ]
          ]
        ],
        "type": "Polygon"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
          [
            [
              31.887789464378926,
              30.23658959085607
            ],
            [
              31.887789464378926,
              29.873037052204907
            ],
            [
              32.32042040767857,
              29.873037052204907
            ],
            [
              32.32042040767857,
              30.23658959085607
            ],
            [
              31.887789464378926,
              30.23658959085607
            ]
          ]
        ],
        "type": "Polygon"
      }
    },
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              31.825826387862605,
              31.00223676309081
            ],
            [
              31.806039210424657,
              31.00140203402962
            ],
            [
              31.786443622932087,
              30.998905929340143
            ],
            [
              31.76722933028778,
              30.994772616968778
            ],
            [
              31.748582287032516,
              30.98904211253969
            ],
            [
              31.73068287121789,
              30.98176988583006
            ],
            [
              31.713704116440045,
              30.973026315606763
            ],
            [
              31.69781002026302,
              30.962895998507005
            ],
            [
              31.683153946298052,
              30.951476919143357
            ],
            [
              31.669877136037755,
              30.938879490021773
            ],
            [
              31.658107345195024,
              30.92522547116229
            ],
            [
              31.647957617790116,
              30.91064678049225
            ],
            [
              31.639525209593163,
              30.895284207128956
            ],
            [
              31.632890670791483,
              30.879286040573156
            ],
            [
              31.628117095939984,
              30.86280662958916
            ],
            [
              31.6252495473975,
              30.846004885147245
            ],
            [
              31.624314656578303,
              30.829042742246024
            ],
            [
              31.62532040548258,
              30.812083595718054
            ],
            [
              31.62825608913543,
              30.79529072525066
            ],
            [
              31.633092457780872,
              30.778825724831066
            ],
            [
              31.639782035964778,
              30.76284695165531
            ],
            [
              31.64825961401193,
              30.747508009229527
            ],
            [
              31.658442905870714,
              30.732956278949292
            ],
            [
              31.670233365872868,
              30.719331513874923
            ],
            [
              31.683517155641564,
              30.706764507737702
            ],
            [
              31.698166251183565,
              30.69537585142312
            ],
            [
              31.714039679121345,
              30.685274788292745
            ],
            [
              31.73098487006017,
              30.676558178735
            ],
            [
              31.7488391162405,
              30.669309583288175
            ],
            [
              31.767431119897633,
              30.663598472564434
            ],
            [
              31.786582618133146,
              30.659479571033227
            ],
            [
              31.806110069595164,
              30.656992340502523
            ],
            [
              31.825826387862605,
              30.656160607879293
            ],
            [
              31.845542706130054,
              30.656992340502523
            ],
            [
              31.86507015759207,
              30.659479571033227
            ],
            [
              31.884221655827584,
              30.663598472564434
            ],
            [
              31.902813659484714,
              30.669309583288175
            ],
            [
              31.920667905665045,
              30.676558178735
            ],
            [
              31.93761309660387,
              30.685274788292745
            ],
            [
              31.953486524541656,
              30.69537585142312
            ],
            [
              31.96813562008365,
              30.706764507737702
            ],
            [
              31.981419409852347,
              30.719331513874923
            ],
            [
              31.993209869854503,
              30.732956278949292
            ],
            [
              32.00339316171329,
              30.747508009229527
            ],
            [
              32.01187073976044,
              30.76284695165531
            ],
            [
              32.01856031794434,
              30.778825724831066
            ],
            [
              32.02339668658979,
              30.79529072525066
            ],
            [
              32.026332370242635,
              30.812083595718054
            ],
            [
              32.02733811914691,
              30.829042742246024
            ],
            [
              32.02640322832771,
              30.846004885147245
            ],
            [
              32.02353567978523,
              30.86280662958916
            ],
            [
              32.018762104933735,
              30.879286040573156
            ],
            [
              32.01212756613206,
              30.895284207128956
            ],
            [
              32.003695157935105,
              30.91064678049225
            ],
            [
              31.99354543053019,
              30.92522547116229
            ],
            [
              31.98177563968746,
              30.938879490021773
            ],
            [
              31.968498829427165,
              30.951476919143357
            ],
            [
              31.953842755462194,
              30.962895998507005
            ],
            [
              31.93794865928517,
              30.973026315606763
            ],
            [
              31.920969904507324,
              30.98176988583006
            ],
            [
              31.9030704886927,
              30.98904211253969
            ],
            [
              31.884423445437438,
              30.994772616968778
            ],
            [
              31.86520915279313,
              30.998905929340143
            ],
            [
              31.84561356530056,
              31.00140203402962
            ],
            [
              31.825826387862605,
              31.00223676309081
            ]
          ]
        ]
      }
    }
  ]
}

Wiki Notes

  • GeoJSON是一种开放的标准格式,用于表示简单的地理特征沿着非空间属性。它基于JSON格式。

  • 这些特征包括点(因此是地址和位置)、线串(因此是街道、高速公路和边界)、多边形(国家、省、大片土地)以及这些类型的多部分集合。

Types
Picture
Code

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

线

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

多边形

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

多边形

{
    "type": "Polygon", 
    "coordinates": [
        [
            [35.0, 10.0],
            [45.0, 45.0],
            [15.0, 40.0],
            [10.0, 20.0],
            [35.0, 10.0]
        ],
        [
            [20.0, 30.0],
            [35.0, 35.0],
            [30.0, 20.0],
            [20.0, 30.0]
        ]
    ]
}

多点

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

多线

{
    "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]
        ]
    ]
}

多体

{
    "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]
            ]
        ]
    ]
}

多体

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

集合

{
    "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]
            ]
        },
        {
            "type": "Polygon",
            "coordinates": [
                [
                    [40.0, 40.0],
                    [20.0, 45.0],
                    [45.0, 30.0],
                    [40.0, 40.0]
                ]
            ]
        }
    ]
}

最后更新于

这有帮助吗?