[OpenLayers-Dev] Sector and Arc Geometry

Christopher Schmidt crschmidt at metacarta.com
Tue Sep 4 11:15:34 EDT 2007


On Tue, Sep 04, 2007 at 03:57:47PM +0400, Vladimir Elistratov wrote:
> I suggested to include Sector and Arc Geometry to the library. Example 
> application is pie charts on a map.
> What do you think?
> 
> I have already implemented Sector for SVG.


"""
For the most part, geometries in OpenLayers correspond to those
described by the GML Simple Features Profile
(http://www.ogcnetwork.net/gml-sf). In particular, they are "points,
lines, polygons (and collections of these)."

In order to fit in with the other geometry classes, it is important that
geometry.calculateBounds sets geometry.bounds as the the envelope of the
geometry.

In addition, the geometry.toString method returns Well-Known Text for
all geometries. Geometries cannot only be serialized into WKT, but also
GML, KML, GeoRSS, and GeoJSON. This is accomplished with the Format
classes.

This last bit allows all geometries to be serialized and sent to some
persistance layer.

All these things (in my mind) are important (and defining)
characteristics of the geometry classes. 
"""

 -- tschaub, #903

I'd be surprised to find that sectors and arcs can not be represented by
sufficiently complex polygons. There is an outstanding patch to add
support for a Class instance on Polygon to support creation of
regular-polygons: that is, multisided polygons with the same angle
between each side. These approximate a circle for a sufficiently large 
side value. I would expect that a sector or arc would simply be a
partial-circle, possibly a linestring instead of a polygon. Either of
these are probably welcome helper functions to the appropriate geometry
types, given sufficient tests.

I think this would resolve your specific use case. If it doesn't, I may
be misunderstanding: further feedback welcome. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list