Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
How are you getting/building the Geometry? From User interaction? or From GeoJSON/WKT? or something else? – Devdatta Tengshe Jan 28 '14 at 7:39
From user interaction – Mohammed shafeek Jan 28 '14 at 8:46
Please provide more information on how you are getting the geometry from the user. Please see this post on how you could improve this question:… – Devdatta Tengshe Jan 28 '14 at 9:25

In OpenLayers you can't but you can use the excellent JavaScript Topology Suite (a Javascript rewrite of the Java Topology Suite).


  var reader = new;
  var geom ='POLYGON ((80 300, 280 300, 280 80, 80 80, 80 300), (260 280, 180 200, 100 280, 100 100, 260 100, 260 280))');        
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.