3

Is it possible to access geojson properties using the OpenLayers library? I tried to search for it but couldn't find any proper answer. According to my research, the library converts each geojson feature to ol.Feature which doesn't provide any access to the properties.

For eg:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.6]
      },
      "properties": {
        "prop0": "value0"
      }
    }
}

How can I access prop0 using the openlayers library?

1 Answer 1

6

Please use:

feature.get("prop0")
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.