[OpenLayers-Users] Request? - non-self-intersecting polygons

Stephen Woodbridge woodbri at swoodbridge.com
Tue Mar 27 10:52:34 EDT 2007


Tim Schaub wrote:
> Hey-
> 
> Jeff Dege wrote:
>> To your typical computer-science geek, polygons that have lines that
>> intersect themselves is a neat idea.  If you draw a pentagram, the
>> center pentagon is "outside" the polygon, while the five points are
>> "inside" the polygon.
>>
>> The polygon drawing tool in OpenLayers works this way.
>>
>> It shouldn't.  Not for this user domain.
>>
>> Map people aren't drawing geometric shapes, they're drawing features on
>> the map.  Overlapping borders don't happen.  And shouldn't happen, with
>> the tool.
>>
> 
> I think the "correct" result of digitizing a pentagram is five polygons. 
>   The result would look much like what you get now, but it would be five 
> features instead of one.  At this point, OpenLayers allows 
> self-intersecting features mainly because it doesn't have any methods to 
>    identify intersecting segments.  I imagine it will stay this way for 
> a while.  The algorithms are not too complex, there is just too much 
> other work to get done.
> 
> If you're looking for a place to change this behavior, it shouldn't be 
> done during digitizing - the geometry should be cleaned after the sketch 
> is complete.

Tim,

I'm thinking that the rules for drawing should probably be driven by the 
  process the will be consuming the drawn geometry. For example, PostGIS 
might have different rules from "Joe's OL Sketch Pad", etc. To that end, 
the consuming process should probably validate the geometry or the rules 
for validation need to be passed to OL with the idea that OL would 
validate the geometry as proxy for the consumer.

1) Having the consumer process validate the geometery puts it a little 
late in the process for good interactive feedback and corrections. Or 
might require a lot of little ajax requests.

2) Having OL process some rules on behalf of the consumer may be overly 
complex to define rules and a protocol for this and implement the rules 
in OL.

As you said there is a lot of other priority items to work on so 1) is 
likely the defacto case for now. I like the idea of rules based 
validation and it would be interesting see a definition of a default set 
of rules for the various geometry classes based on OGC geometries.

-Steve



More information about the Users mailing list