- Geojson数据解析
GeoJSON是一种对各种地理数据结构进行编码的格式。GeoJSON对象可以表示几何、特征或者特征集合。GeoJSON支持下面几何类型:点、线、面、多点、多线、多面和几何集合。GeoJSON里的特征包含一个几何对象和其他属性,特征集合表示一系列特征。
一个完整的GeoJSON数据结构总是一个(JSON术语里的)对象。在GeoJSON里,对象由名/值对–也称作成员的集合组成。对每个成员来说,名字总是字符串。成员的值要么是字符串、数字、对象、数组,要么是下面文本常量中的一个:“true”,“false"和"null”。数组是由值是上面所说的元素组成。
GeoJSON集合特征:
{
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"id":"001",
"properties":{
"name":"新华001"},
"geometry":{
"type": "Point", "coordinates":[121.9850,42.6737]}},
{
"type":"Feature",
"id":"002",
"properties":{
"name":"新华002"},
"geometry":{
"type": "Point", "coordinates":[121.8345,42.4898]}},
{
"type":"Feature",
"id":"003",
"properties":{
"name":"峰山1"},
"geometry":{
"type": "LineString", "coordinates":[[121.9850,42.6737],[121.8345,42.4898]]}},
{
"type":"Feature",
"id":"004",
"properties":{
"name":"新华1001"},
"geometry":{
"type": "Point", "coordinates":[128.9850,42.6737]}},
{
"type":"Feature",
"id":"005",
"properties":{
"name":"新华1002"},
"geometry":{
"type": "Point", "coordinates":[125.8345,42.4898]}},
{
"type":"Feature",
"id":"006",
"properties":{
"name":"峰山2"},
"geometry":{
"type": "LineString", "coordinates":[[121.9850,42.6737],[1