可以通过一下地址验证
https://geojson.io/#map=11.2/38.2756/116.7917
一个面数据的情况,
features是一个数组,geometry 的type=Polygon表示一个面数据,可以存放多个面数据,以下就存放了一个面
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } }] }
geometry 的type=Polygon,存放多个面
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, "properties": { "prop0": "roger" } },{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ] ] }, "properties": { "prop0": "james" } }] }
geometry 的type=MultiPolygon,存放多个面
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ] ], [ [ [100.2, 0.2], [100.2, 0.8], [100.8, 0.8], [100.8, 0.2], [100.2, 0.2] ] ] ] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } },{ "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, "properties": { "prop0": "roger" } }] }
多线
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "MultiLineString", "coordinates": [ [ [170.0, 45.0], [180.0, 45.0] ], [ [-180.0, 45.0], [-170.0, 45.0] ] ] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } }] }
单线数据
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [ 170, 45 ], [ 180, 45 ] ] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } }] }
单点数据
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [170, 45] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } }] }
多点数据
{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "MultiPoint", "coordinates": [ [170, 45], [180, 45] ] }, "properties": { "prop0": "value0", "prop1": { "this": "that" } } }] }