How to use the jsts/org/locationtech/jts/io/GeoJSONReader.js function in jsts

To help you get started, we’ve selected a few jsts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 3liz / lizmap-web-client / assets / src / modules / SelectionTool.js View on Github external
() => {
                if(this.isActive){
                    const selectionFeature = mainLizmap.digitizing.featureDrawn;

                    if (selectionFeature){
                        // Handle buffer if any
                        this._bufferLayer.destroyFeatures();
                        if (this._bufferValue > 0) {
                            const geoJSONParser = new OpenLayers.Format.GeoJSON();
                            const drawGeoJSON = geoJSONParser.write(selectionFeature.geometry);
                            const jstsGeoJSONReader = new GeoJSONReader();
                            const jstsGeoJSONWriter = new GeoJSONWriter();
                            const jstsGeom = jstsGeoJSONReader.read(drawGeoJSON);
                            const jstsbBufferedGeom = BufferOp.bufferOp(jstsGeom, this._bufferValue);
                            const bufferedDraw = geoJSONParser.read(jstsGeoJSONWriter.write(jstsbBufferedGeom));

                            // Draw buffer
                            this._bufferLayer.addFeatures(bufferedDraw);
                            this._bufferLayer.redraw(true);
                        }

                        for (const featureType of this.allFeatureTypeSelected) {
                            mainLizmap.lizmap3.selectLayerFeaturesFromSelectionFeature(featureType, this.featureDrawnBuffered || selectionFeature, this._geomOperator);
                        }
                    }
                }
            },