tpkc-topochecker
v1.0.3
Published
Backend tool for BIM_GIS_ML-68
Downloads
1
Readme
tpkc-topoChecker
Backend tool for BIM_GIS_ML-68
Intro
用typescript編寫,compile成commonjs型式的javascript,如有需要也能compile成AMD或UMD。 後端可直接取用GeoJsonValidator.js這包code。
Usage
於constructor中定義每種geometry type的處理方式
點(point) : repair強制選取第一個點,toPolyline將型別改成Polyline
線(line) : toPoint將只有一個座標的Polyline轉換成點
面(polygon) : repair強制封閉polyline,toPolyline轉換成Polyline
複合點(MultiPoint) : repair強制選取第一個點
複合線(MultiPolyline) : ignore無視,toPolyline若傳入的只有一條線則轉型成普通的Polyline,toPoint若只有一條線並只有一個座標則轉換成點
複合面(MultiPolygon) : repair將所有傳入的線強制封閉成線
npm i geojsonvalnpm
// require module
let GeoJsonValidator = require('geojsonvalnpm');
// this is a geojson variable
let staticGeoJson = {};
// new instance
let myChecker = new GeoJsonValidator.default({
pointOption: "repair",
polylineOption: "toPoint",
polygonOption: "toPolyline",
multiPointOption: "repair",
multiPolylineOption: "toPoint",
multiPolygonOption: "repair"
});
// reqair geojson
myChecker.repairGeoJson(staticGeoJson)