I have a system where a user can upload a SHP through a web form. I upload this SHP and import it to GeoServer via REST API. Later the user can interact with the data using a web client with OpenLayers.
Even though the property fields in the SHP are specified by the requirements I'm having lots of issues regarding the case sensitiveness of feature's property names. So, some of the SHP include features with a property called LENGTH
, or length
, or Length
...
I'm wondering if there's an easy way to set OpenLayers in some kind of case-insensitive mode or if should I iterate all features when importing to GeoServer to convert all properties to lowercase (or uppercase, it doesn't really matter)
Edit: Answering notkilroy's comment, the problem is that my features' properties appear as undefined
if they I check them lowercased but in the shapefile are in any other case form.
/**
* Assume the loaded SHP has all properties defined UPPERCASE in this case
*/
var Properties = {
LENGTH: 'length',
…
}
var featureLength = feature.getProperties()[Properties.LENGTH]; // undefined
var featureLength = feature.get(Properties.LENGTH); // undefined