[OpenLayers-Users] Vector feature attribute name

Alexandre Dube adube at mapgears.com
Mon Oct 27 10:40:25 EDT 2008


Hi Bart,

  Hey, that's a great idea.  I'm using Mapserver ( shp data in uppercase 
) and tinyows ( postgis data in lowercase ).  I don't think changing 
anything like that in tinyows might be possible, so I'll just try to add 
aliases in Mapserver to attributes the sames as tinyows.

Thanks a lot,

Alexandre

bartvde at osgis.nl wrote:
> 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
>>
>>     
>
>
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list