Issue with geojson layer in Perspective Map

I am having an issue with Perspective Map and I wanted to see if anyone else has experienced this:

If I have a Map and I manually create the structure:

The map loads fine.

If I bind features to anything and hit save, the map, in both the browser and designer, will show

with the error: can't access property "length", s.features is undefined. This is also shown in the js console.

If I reload the web page it works again. It seems to only break on designer save.

If I set the prop to Persistent, that also seems to fix it.

Binding lower level props or the whole array (layers.other.geoJSON[0]) also seems to work fine.

Any thoughts? I’ll try sending this to support soon if this isn’t a me thing

I should add that the reason I want to bind features specifically is that this is easy to get from Postgresql, and I want to have a styleOptions field. Its nice when this field is known to Designer, rather than being set from a script, so that its easier to use

Bindings that require a callout to a DB or across the network will supply a null until the data arrives. You should place the binding on a custom property, and use coalesce() to substitute a default value for features until the null is replaced.

1 Like

ahh, perfect! I thought there would be an easy way to do this. Thank you!

1 Like

Sorry for an additional late reply, I had an alternative but worse solution when I posted this, and I’ve just gotten around to trying this properly.

I can’t get coalesce to work, or a script checking for None. I have the binding on a separate custom property as suggested, then I’ve tried:

  • using using a property binding to get it onto layers.ui.other.geoJSON[2].features, with a transform
  • using an expression binding with coalesce directly

As a test, I tried both of these targeting a binding of a blank array.

The only way I can get a binding (at the features level) to work is by also setting the feature to be persistent

I can't read your mind nor see how you applied or misapplied the coalesce() function. Show us.

Absolutely. I apologise as well for the infrequent replies, I’ve been under a bit of a time crunch. I’ll try and get you screenshots/code blocks. Thank you!

Thank you for your time and patience.

Here is a Map, with layers.other.geoJSON.0.features bound on the right:

I have this.custom.array as just an empty way as I wasn’t sure of the best way to return an array from this.

this.custom.features is bound to:

Upon saving this in Designer, the can't access property "length", s.features is undefined occurs. Refreshing the the browser does occasionally work, but not permanently.