[OpenLayers-Users] Validate polygon

Alexandre Dube adube at mapgears.com
Wed Sep 10 14:44:22 EDT 2008


Hi Bas,

  You can check the geometry object of your feature.  You'll find a 
Polygon object which has points and there you can check the first and 
the last if they have the same coordinates.

  yourFeature.geometry.components[0].components[0].x    // the first point.x
  yourFeature.geometry.components[0].components[0].y    // the first point.y

  yourFeature.geometry.components[0].components[last].x    // the last 
point.x
  yourFeature.geometry.components[0].components[last].x    // the last 
point.y

Hope this helps,

Alexandre

Bas Couwenberg wrote:
> Hello,
>
> is there a way in OpenLayers to check if a feature is a valid Polygon? 
> I want to check it the start and end point are the same coordinate and 
> such.
>
> Best regards,
>
> Bas Couwenberg
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list