[OpenLayers-Dev] centroid for linestrings

Tim Schaub tschaub at opengeo.org
Thu Jan 5 13:03:49 EST 2012

I think things are screwed up here in a few ways.  If we're going to
support a fast and slow method, I would think the fast should return
the center of the bounds and the slow should return the weighted

I know that it was not intended for the first point of a line to be
returned as the centroid.  I think this was an optimization to use the
first component of multi-part geometries, and linestrings were


On Wed, Jan 4, 2012 at 4:09 AM, Pierre Giraud
<pierre.giraud at camptocamp.com> wrote:
> Hello all,
> Recently I found out that the getCentroid method for linestring
> geometries return the first point of the line.
> According to this changeset [1], user needs to set true to the
> getCentroid argument (weighted) in order to get the *real* centroid.
> In my opinion, this "weighted" option should be set to true unless
> user explicitely set it to false.
> Any other opinion?
> Pierre
> [1] http://trac.osgeo.org/openlayers/changeset/10652
> --
> Pierre GIRAUD
> Géomaticien, Analyste
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> Tel : 00 33 4 79 44 44 93
> Mail : pierre.giraud at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Tim Schaub
OpenGeo http://opengeo.org/
Expert service straight from the developers.

More information about the Dev mailing list