How can I validate the geometry in Openlayers?
I need to check "MULTILINESTRING()" (which is empty) is valid/not valid. In postGIS, for Geometry validation we are using "isValid()" function. Like this, is there any options in Openlayers?
How can I validate the geometry in Openlayers?
I need to check "MULTILINESTRING()" (which is empty) is valid/not valid. In postGIS, for Geometry validation we are using "isValid()" function. Like this, is there any options in Openlayers?
In OpenLayers you can't but you can use the excellent JavaScript Topology Suite (a Javascript rewrite of the Java Topology Suite).
Example:
var reader = new jsts.io.WKTReader();
var geom = reader.read('POLYGON ((80 300, 280 300, 280 80, 80 80, 80 300), (260 280, 180 200, 100 280, 100 100, 260 100, 260 280))');
console.log(geom.isValid());
If you are using geodata through some form of GeoJson I can recommend this link;
It has an API that you can use as well, both python and javascript are explained on the website. With the api you are able to post a geojson and it will reply with a request status.