GIS 常用 npm 包:GeoJSON 文件合并与元素过滤\属性过滤\图形合并
GeoJSON 文件合并
普通的 geoJSON 文件合并,只需 geojson-merge 插件就够了,https://www.npmjs.com/package/@mapbox/geojson-merge
mergeFeatureCollectionStream 合并文件
Merge GeoJSON files containing GeoJSON FeatureCollections into a single stream of a FeatureCollection as a JSON string.
merge 合并 GeoJSON 数组
Merge a series of GeoJSON objects into one FeatureCollection containing all features in all files. The objects can be any valid GeoJSON root object, including FeatureCollection, Feature, and Geometry types.
合并文件,官网的案例
在浏览器端,需要导入文件,fileReader 读取文件,获取 json,再合并
GeoJSON 过滤
GeoJSON 一 feature properties 过滤
https://www.npmjs.com/package/turf-filter
turf.filter(features, key, value)
这个过滤比较简单,https://www.npmjs.com/package/feature-filter-geojson
可以增加过滤规则,具体还是看官方文档。在浏览器端,其实用第一个就好
https://www.npmjs.com/package/geojson-filter,这个也是一样的,但是推荐用第一个
geojson-dissolve
GeoJSON 里面的点线面合并为 Multi(point/linestring/polygon)
Dissolve contiguous GeoJSON (Multi)LineStrings and (Multi)Polygons into single units.
说实话,这个实际项目,我目前还没有用到。
merge polygon 合并多边形
merge-simple-polygons:https://www.npmjs.com/package/merge-simple-polygons
Merge two (adjacent) simple polygons into another simple polygon.
Takes two arrays of vertex IDs, each spanning a planar polygon and returns:
false if the given polygons share no vertices
null if there would be more than one resulting simple polygon (if the two given polygons share either exactly one vertex, which would result in two polygons or multiple egdes that are not connected, which would result in a polygon with a "hole")
a list of vertex IDs forming the merged polygon
这个,turfjs http://turfjs.org/docs/#booleanContains
其他 GIS 数据转 GeoJSON
Turn your geo data into GeoJSON.
转载本站文章《GIS常用npm包:GeoJSON文件合并与元素过滤\属性过滤\图形合并》,请注明出处:https://www.zhoulujun.cn/html/GIS/WebGIS/8201.html
评论