GeoJson学习记录

最近需要使用GeoJson来做传输交换格式,查了下资料。

  1. 官方网址; http://geojson.org/geojson-spec.html
  2. GeoJson支持点、线、面、多点、多线、多面、对象集合、记录、记录集合这几种类型,每一个GeoJson对象都一个类型成员。其中前六种为单一的空间对象类型。
    1. 点:[100.0,0.0]
    2. 点串: [ [100.0,0.0], [101.0,1.0] ]
    3. 多个点串:[点串1, 点串2]
    4. 对象:{"type":,  "coordinates": }
      1. 点对象:{ "type": "Point","coordinates":}
      2. 线对象:{ "type": "LineString","coordinates":点串 }
      3. 面对象:{"type": "Polygon", "coordinates": [点串1, 点串2] }
      4. 多点对象:{"type": "MultiPoint","coordinates": 点串 }
      5. 多线对象:{"type": "MultiLineString", "coordinates": [点串1, 点串2] }
      6. 多面对象:{"type": "MultiPolygon", "coordinates": [多个点串1, 多个点串2] }
    5. 对象集合:
       { "type": "GeometryCollection",
          "geometries": [
           对象1, 对象2
          ]
        }
    6. 记录:     
               { "type":"Feature",
              "geometry": 对象,
              "properties": {
                "prop0": "value0",
                "prop1": 0.0
                }
              }
    7. 记录集合:
      { "type": "FeatureCollection",
          "features": [
           记录1, 记录2
          ]
        }
  3. 空间对象有一个 点串成员来记录空间坐标。
  4. 每一个GeoJson对象可以有 坐标系、对象范围(感觉是对象的Bounds)两个成员。
  5. 例子:
    1.   { "type":"Point", "coordinates":[100.0, 0.0] }
    2. { "type":"LineString",
          "coordinates": [ [100.0,0.0], [101.0,1.0] ]
          }
    3.   { "type":"Polygon",
          "coordinates": [
            [ [100.0,0.0], [101.0,0.0], [101.0,1.0], [100.0,1.0], [100.0,0.0] ]
            ]
         }
    4.   { "type": "MultiPoint",
          "coordinates": [ [100.0,0.0], [101.0,1.0] ]
          }
    5. {"type": "MultiLineString",
          "coordinates": [
              [ [100.0,0.0], [101.0,1.0] ],
              [ [102.0,2.0], [103.0,3.0] ]
            ]
          }
    6.  {"type": "MultiPolygon",
          "coordinates": [
            [[[102.0,2.0], [103.0,2.0], [103.0,3.0], [102.0,3.0], [102.0,2.0]]],
            [[[100.0,0.0], [101.0,0.0], [101.0,1.0], [100.0,1.0], [100.0,0.0]],
             [[100.2,0.2], [100.8,0.2], [100.8,0.8], [100.2,0.8], [100.2,0.2]]]
            ]
          }
    7.  { "type": "GeometryCollection",
          "geometries": [
            { "type":"Point",
              "coordinates": [100.0, 0.0]
              },
            { "type":"LineString",
              "coordinates": [ [101.0,0.0], [102.0,1.0] ]
              }
          ]
        }
    8.      { "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
                }
              }
    9.  { "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
                }
              },
            { "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"}
                 }
               }
             ]
           }

转载请注明出处: http://write.blog.csdn.net/postedit/42741097 qianjn




郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。