[Geoprisma-dev] InitialView issue

Yves Moisan yves.moisan at boreal-is.com
Tue May 11 14:25:51 EDT 2010


Le 2010-05-05 08:24, Alexandre Dube a écrit :
> Yves,
>
>  All geometry objects have the 'getBounds' property so you could use 
> it regardless of the geometry type, then use 'getCenterLonLat' of the 
> returned Bounds object to get the center to create your point feature 
> from.
>
Hi Alexandre,

Thanx for the pointer.  I tested on the GP InitialView example 
(http://localhost:8081/gp/samples/initialview/index.php?workspace=wms2&id=302) 
and what I thought would apply only to polygons ends up applying to 
points as well.  As it turns out, geometry.point has a getCentroid 
function.  geometry.polygon does not, but it inherits from linearRing 
and that has a getCentroid.  I haven't tested with a geometry.linestring 
but I went up the dependeny stack and geometry.collection implements a 
getCentroid, so my guess is that it works for lines too.  I'll commit 
what I have now.  I'll add a linestring example later.

Thanx (and sorry for the late answer!),

Yves




More information about the Geoprisma-dev mailing list