首页 > 编程知识 正文

geojson是什么格式,java geojson

时间:2023-05-05 10:58:39 阅读:263443 作者:2736

{ "type": "FeatureCollection", "features": [ /*表示地图上一个点*/ { "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 117.24609374999999, 36.65079252503471 ] } }, /*表示地图上一条线段*/ { "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 117.24599450826645, 36.65120999361623 ], [ 117.24690914154054, 36.65124657580678 ], [ 117.24694132804869, 36.65100341150826 ], [ 117.24670529365538, 36.650695689215624 ], [ 117.24620908498764, 36.65059024562966 ] ] } }, /*表示地图上一个多边形(三角形,正方形,长方形....等等)*/ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 117.15253829956055, 36.67089730689858 ], [ 117.14584350585938, 36.658917692387114 ], [ 117.16318130493163, 36.64721167063527 ], [ 117.17554092407227, 36.65313376288551 ], [ 117.18034744262694, 36.66773046368491 ], [ 117.17348098754883, 36.677643625245274 ], [ 117.15322494506836, 36.692786266889456 ], [ 117.13193893432617, 36.68397636535661 ], [ 117.15047836303711, 36.68012171607383 ], [ 117.15253829956055, 36.67089730689858 ] ] ] } } ]}

在开发过程中调用一个webAPI的接口,需要传递一个Geojson格式的string字符串:

需求是传递一条线段,期间一直报错无法解析,研究半天,正确格式如下:

"SpatialLocationStr": "{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"LINESTRING","coordinates":[[119.92166720920139,29.446581488715278],[119.92151638454861,29.446602918836806],[119.9212109375,29.44662923177083],[119.92076144748263,29.44669677734375],[119.92043023003473,29.446729329427082],[119.92002549913194,29.44680392795139],[119.91955702039931,29.446898328993054],[119.91920844184028,29.446982421875],[119.91896402994792,29.447027452256943],[119.91886962890625,29.44716335720486]]}}]}"

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。