[OpenLayers-Users] Vector feature attribute name
bartvde at osgis.nl
bartvde at osgis.nl
Mon Oct 27 10:04:36 EDT 2008
I assume you are using Mapserver?
So why not create alias-es on your WFS?
"gml_res_co_reg_alias" "RES_CO_REG"
Best regards,
Bart
> Hi list,
>
> I have a little problem with attribute names for vector features. In
> my application, I have 2 data sources ( shapefiles and postGIS ) that
> share the exact same kind of data. The only difference is the attribute
> names, which are respectively in uppercase and lowercase ( ex. :
> RES_CO_REG, res_co_reg )
>
> My application must interact in both ways they are written ( or
> preferably, ANY way they are written), so before using an attribute
> name, I use this little function I've written :
>
> OpenLayers.Feature.Vector.prototype.getAttributeName = function (szName) {
> szName = szName.toUpperCase();
> var szAttribute, key;
> for ( key in this.attributes ) {
> szAttribute = key.toUpperCase();
> if (szAttribute == szName)
> return key;
> }
> return false;
> }
>
> This works on feature objects. I didn't find a way to do it otherwise.
> Like when using the addUniqueValueRules function, I have to do the
> following :
> oRegStyleMap.addUniqueValueRules("default", "RES_CO_REG", aRegColor);
> oRegStyleMap.addUniqueValueRules("default", "res_co_reg", aRegColor);
>
> To me, it seems like my solution is a big waste of time ( having to
> loop into each attribute name every time )... Is there a better way to
> do it ?
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list