# Error on Irregular Polygon Vertex

**URL:** <https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395>\
**Category:** WebForms\
**Created:** [July 14, 2010, 9:46am UTC](https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395 "2010-07-14T09:46:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttd](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@ttd](https://community.thinkgeo.com/u/ttd)\
**Post date:** [July 14, 2010, 9:46am UTC](https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395/1 "2010-07-14T09:46:38Z")

</div>

We&nbsp;are&nbsp;using&nbsp;WebEdition&nbsp;3.1.299&nbsp;with&nbsp;Bing&nbsp;imagery&nbsp;service.&nbsp;We&nbsp;got&nbsp;an&nbsp;error&nbsp;&nbsp;when&nbsp;trying&nbsp;to&nbsp;add&nbsp;irregular&nbsp;polygon&nbsp;features&nbsp;(with&nbsp;numerous&nbsp;crossing&nbsp;vertexes)&nbsp;into&nbsp;the&nbsp;inMemory&nbsp;layer.&nbsp;Attached&nbsp;is&nbsp;the&nbsp;error&nbsp;we&nbsp;are&nbsp;getting.&nbsp;

Is&nbsp;there&nbsp;a&nbsp;property&nbsp;that&nbsp;we&nbsp;could&nbsp;set&nbsp;to&nbsp;override&nbsp;this&nbsp;error?&nbsp;If&nbsp;not,&nbsp;how&nbsp;could&nbsp;we&nbsp;check&nbsp;in&nbsp;javascript&nbsp;if&nbsp;the&nbsp;feature&nbsp;meet&nbsp;the&nbsp;validation&nbsp;or&nbsp;how&nbsp;could&nbsp;we&nbsp;restrict&nbsp;the&nbsp;user&nbsp;from&nbsp;drawing&nbsp;feature&nbsp;that&nbsp;failed&nbsp;the&nbsp;validation.&nbsp;Please&nbsp;advise

---

<div class="post-metadata">

**Author:** ![Khalil](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/bc8723/32.png) [@Khalil](https://community.thinkgeo.com/u/Khalil)\
**Post date:** [July 19, 2010, 1:36am UTC](https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395/2 "2010-07-19T01:36:26Z")

</div>

ttd,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;information&nbsp;about&nbsp;this&nbsp;post.&nbsp;  
&nbsp;&nbsp;  
&nbsp;From&nbsp;your&nbsp;attached&nbsp;txt&nbsp;flat&nbsp;file,&nbsp;I&nbsp;guess&nbsp;that&nbsp;the&nbsp;error&nbsp;is&nbsp;caused&nbsp;by&nbsp;that&nbsp;you&nbsp;have&nbsp;added&nbsp;a&nbsp;invalid&nbsp;WKT,&nbsp;so&nbsp;that&nbsp;it&nbsp;can’t&nbsp;pass&nbsp;the&nbsp;validation&nbsp;for&nbsp;wkt&nbsp;string.&nbsp;  
&nbsp;If&nbsp;it&nbsp;failed&nbsp;during&nbsp;the&nbsp;validation&nbsp;and&nbsp;it&nbsp;can’t&nbsp;be&nbsp;added&nbsp;into&nbsp;InMemoryFeatureLayer.&nbsp;&nbsp;  
&nbsp;I&nbsp;don’t&nbsp;know&nbsp;how&nbsp;you&nbsp;let&nbsp;the&nbsp;users&nbsp;draw&nbsp;the&nbsp;features?&nbsp;If&nbsp;using&nbsp;EditOverlay&nbsp;and&nbsp;I&nbsp;think&nbsp;it&nbsp;will&nbsp;works&nbsp;well.&nbsp;If&nbsp;you&nbsp;don’t&nbsp;know&nbsp;how&nbsp;to&nbsp;use&nbsp;EditOverlay,&nbsp;please&nbsp;refer&nbsp;to&nbsp;the&nbsp;“DrawEditShapes”&nbsp;sample&nbsp;in&nbsp;our&nbsp;installed&nbsp;samples&nbsp;which&nbsp;you&nbsp;could&nbsp;find&nbsp;its&nbsp;source&nbsp;code&nbsp;at&nbsp;“Samples\MapShapes\DrawEditShapes.aspx”.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Khalil

---

<div class="post-metadata">

**Author:** ![ttd](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/90ced4/32.png) [@ttd](https://community.thinkgeo.com/u/ttd)\
**Post date:** [September 30, 2010, 11:06am UTC](https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395/3 "2010-09-30T11:06:40Z")

</div>

We&nbsp;get&nbsp;this&nbsp;errors&nbsp;when&nbsp;the&nbsp;user&nbsp;draw&nbsp;on&nbsp;Polygon&nbsp;(client-side:&nbsp;javascript:&nbsp;Map1.SetDrawMode(‘Polygon’))&nbsp;with&nbsp;not&nbsp;enough&nbsp;vertexes.&nbsp;How&nbsp;could&nbsp;I&nbsp;validate&nbsp;if&nbsp;the&nbsp;polygon&nbsp;drawn&nbsp;shape&nbsp;(vertexes)&nbsp;is&nbsp;valid&nbsp;in&nbsp;Javascript?

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [October 4, 2010, 10:21am UTC](https://community.thinkgeo.com/t/error-on-irregular-polygon-vertex/5395/4 "2010-10-04T10:21:32Z")

</div>

ttd,

On&nbsp;client&nbsp;side,&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;code&nbsp;below&nbsp;to&nbsp;try&nbsp;parsing&nbsp;the&nbsp;WKT&nbsp;to&nbsp;check&nbsp;it’s&nbsp;invalid.  
var&nbsp;wktParser&nbsp;=&nbsp;new&nbsp;OpenLayers.Format.WKT();  
var&nbsp;feature&nbsp;=&nbsp;wktParser.read(“WKT&nbsp;String&nbsp;used&nbsp;for&nbsp;parsing”);  
if(feature&nbsp;!=&nbsp;null)  
{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Valid  
}  
Else  
{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Invalid.  
}  
But&nbsp;the&nbsp;best&nbsp;validation&nbsp;should&nbsp;be&nbsp;added&nbsp;on&nbsp;Server-Side,&nbsp;because&nbsp;the&nbsp;client&nbsp;side&nbsp;validation&nbsp;comes&nbsp;from&nbsp;OpenLayers&nbsp;JavaScript&nbsp;library.  
Thanks,  
Johnny&nbsp;&nbsp;
