What type is the argument of a function "buildGeometry" of JavaScript library JSTS? How to use JSTS function "buildGeometry" with OpenLayers 3 selection, which is created is this way:
window.select = new ol.interaction.Select({
layers: window.layers, //an array of OpenLayers layers
wrapX: false
});
According to documentation, the class 'ol.interaction.Select' has a method 'getFeatures', which returns 'ol.Collection.<ol.Feature>' object? A code:
var features = window.select.getFeatures();
var geometryFactory = new jsts.geom.GeometryFactory();
var group = geometryFactory.buildGeometry(features);
causes an error:
Uncaught TypeError: t.iterator is not a function
buildGeometry (...)/js/openlayers3/jsts.js:9
How to use JSTS function "buildGeometry" with 'ol.interaction.Select' and 'ol.Collection.<ol.Feature>' objects? How to create a group with various elements which are selected with OpenLayers 3?
jsts.io.OL3Parser
as in openlayers.org/en/v3.20.1/examples/jsts.html e.g.var geometries = select.getFeatures().getArray().map(function(feature) { return parser.read(feature.getGeometry()); });
Note that in more recent versions of JSTS you must inject the OpenLayers format constructors into the parser.