js 解析geojson格式

时间:2021-08-12 20:53:10

 //下面定义了一个geojson格式数组

var geojsonarry = { "type": "Polygon", "coordinates": [[[122.07535436331365, 31.287773896004534], [122.07660470811187, 31.287773896004534], [122.07660470811187, 31.286523675043622], [122.07535436331365, 31.286523675043622], [122.07535436331365, 31.287773896004534]]] };
var json = JSON.stringify(geojsonarry.coordinates);//把json 转成字符串
alert(json);//得到结果

 

 

更多JSON.stringify  链接:http://www.jb51.net/article/29893.htm