I use the following code to get WFS features on the map.
let WFSlayer = new ol.layer.Vector({
title: layer,
source: new ol.source.Vector({
url: "/proxy/?layer_name=" + layer + "&bbox=" + [bbox[1], bbox[0], bbox[3], bbox[2]],
format: new ol.format.GeoJSON(),
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(243,20,20,0.3)',
width: 15
})
}),
})
I want to access the properties of the loaded features. How should I do it?
This is what my GeoJSON looks like
features: [{type: "Feature", id: "", geometry: {type: "MultiLineString",…},…}]
0: {type: "Feature", id: "", geometry: {type: "MultiLineString",…},…}
geometry: {type: "MultiLineString",…}
geometry_name: "geom"
id: ""
properties: {rc_id: 530530, local_id: 0, dot_id: 6811526, mfips: "51001", geo_et: 0, geo_effdt: null,…}
add_ed: null
add_format: "A"
add_lf: 21321
add_lt: 21451
feature.getProperties()
for the properties object,feature.getKeys()
for the property names,feature.get(key)
for a single property value openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html