[Geoprisma-dev] InitialView issue

Yves Moisan yves.moisan at boreal-is.com
Tue May 4 16:44:41 EDT 2010


Hi All,

It's been a while since there was life on this channel !  I've come 
across an issue today with InitialView for the case of 'no FeatureServer 
layer'.  In that case, a temporary vector layer with a feature (a red 
cross only modifiable in the xslt for now) is created.  Without noticing 
(and also because I didn't care to make real tests ...) I found out 
today that a cross only works for point geometries :

Indeed,

new 
OpenLayers.Geometry.Point(GeoPrisma.Widget.InitialView.oFeatures[0].geometry.x,GeoPrisma.Widget.InitialView.oFeatures[0].geometry.y)

will generate x = y = NaN for anything but points, obviously.

Hardcoding for a polygon with :

new 
OpenLayers.Geometry.Point(GeoPrisma.Widget.InitialView.oFeatures[0].geometry.getCentroid().x,GeoPrisma.Widget.InitialView.oFeatures[0].geometry.getCentroid().y)

works for the case of polygons (only?).

Does anyone have an example of conditional code I could use to check 
geometry type ?  More importantly, I'd like to get all possible code 
options as a function of geometry type, that is get x and y for a point 
and whatever function returns a point as a function of geometry.  
There's gotta be some generic geometry checking code somewhere.

TIA,

Yves



More information about the Geoprisma-dev mailing list