0

I want to get the features from my layer. So I'm requesting WMSGetFeatureInfo method after a successful request for GetFeatureInfo on my layer. The returned object is structured like this:

features object

I can read values like BEVDICHTE with var bevdichte = features.BEVDICHTE and so on. But when I want to get the value of the_geom with var the_geom = features.the_geom it returns an object. Yes it is nested so this is intended but my question is how to get the value ol.geom.MultiPoint from the_geom?

EDIT:

Unfortunately var target = features.the_geom['actualEventTarget_']; will just return another 'actualEventTarget_' object. This is because the the_geom object is nested into infinity. I attached another screenshot to describe my problem. There are many more nested eventTargets following. Yet I was not able to get the property ol.geom.MultiPolygon.

actualeventtarget(s)

Jason Koopmans
  • 611
  • 6
  • 19
Antivist
  • 184
  • 9

1 Answers1

0

To access a nested array, just use brackets: '[ ]'

var nestedArray = [[1,2], [3,4]];
var nestedArrayValue = nestedArray[0][0];
// --> returns 1

With your example:

var target = features.the_geom['actualEventTarget_']

By the way, from the looks of it var the_geom = features.the_geom doesn't seem like an array. It has keys, mapped to a value, are you sure this is an array, not an object?

Mathias Vonende
  • 1,400
  • 1
  • 18
  • 28
  • You're right it is an object. My bad. features['the_geom']['actualEventTarget_'] will return another 'actualEventTarget' object. Unfortunately there are quite alot nested into each other. – Antivist Jun 30 '15 at 14:01