例如我们有吴江区的一份geojson数据,需要把吴江区外的裁减掉,该怎么办那,可以使用turfjs这个库
var poly1 = turf.polygon([[ [-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122.584762, 45.48565], [-122.801742, 45.48565] ]]);var poly2 = turf.polygon([[ [-122.520217, 45.535693], [-122.64038, 45.553967], [-122.720031, 45.526554], [-122.669906, 45.507309], [-122.723464, 45.446643], [-122.532577, 45.408574], [-122.487258, 45.477466], [-122.520217, 45.535693] ]]);var intersection = turf.intersect(poly1, poly2);
http://turfjs.org/docs/#intersect
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接