Error: Accessor#set Assigning an instance of 'esri.layers.SceneLayer' which is not a subclass of 'esri.layers.FeatureLayer'

366
6
Jump to solution
09-10-2020 06:01 AM
MichaelLev
Occasional Contributor III

Hi Robert Scheitlin, GISP‌,

For WAB (Developer Edition) 2.17, I modified the standard 3D "LayerList" widget,

ading a button to display attribute table of layer by opening a custom widget which uses the code from

FeatureTable widget with popup interaction

to display the attribute table within that widget which serves as a "popup".

For some layers it displays the attribute table OK,

but for some other layers it displays only the first line with the field names,

but the whole table is not displayed, so the features data is missing.

Note: the regular popup, activated by clicking the features on the sceneView, works OK,

so this is some problem using the code of the FeatureTable widget from the above example.

The error message I get is

init.js:115 [esri.core.Accessor] Accessor#set Assigning an instance of 'esri.layers.SceneLayer' which is not a subclass of 'esri.layers.FeatureLayer'

I get also a second message:

SceneLayer queries are not available without associated feature layer

Help will be greatly appreciated.

Michael

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Michael,

  So it sounds like what you are sending to the FeatureTables layer property is not what it expects sometimes. You should evaluate the layers typeof  and if it is a SceneLayer then get the url property and create a FeatureLayer from the url then feed that to the FeatureTable.

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Michael,

  So it sounds like what you are sending to the FeatureTables layer property is not what it expects sometimes. You should evaluate the layers typeof  and if it is a SceneLayer then get the url property and create a FeatureLayer from the url then feed that to the FeatureTable.

View solution in original post

0 Kudos
MichaelLev
Occasional Contributor III

Thanks Robert Scheitlin, GISP,

only please instruct me (links?) how to

  1. Check typeof the layer
  2. Get its url
  3. Create a FeatureLayer from the url

I get the layer in the LayerList widget.

Michael

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor
MichaelLev
Occasional Contributor III

Dear Robert Scheitlin, GISP,

Thank you, but I'm afraid that javascript typeof does not know between sceneLayer and featureLayer. It only checks for javascript types.

So I still don't know how can I check if it's a SceneLayer or FeatureLayer?

Additionally, I apologize that as I'm relatively new to GIS, I need know -

  1. Am I assuming right that a SceneLayer with no associated FeatureLayer can still have an attribute table?
  2. If a SceneLayer has an associated FeatureLayer, am I assuming right that the attribute table will "sit" in the FeaturLayer and not in the SceneLayer?
  3. How can I detect in my javascript code whether a specific SceneLayer has an associated FeatureLayer? And how can I "get" that FeatureLayer if I need to?
  4. After creating FeatureLayer from the SceneLayer, can I associate it with the SceneLAyer in my javascript code, or that such association must be done beforehand, when creating the SceneLayer in ArcGIS online?
  5. Since SceneLayer is optimized for displaying large amounts of 3D data in a scene, I assume the GIS man who works on the ArcGIS online, must use a SceneLayer, so, how, in ArcGIS online, a SceneLayer with an associated FeaturLayer can be created?
  6. In my case, FeatureLayer widget fails whilst the regular popup displays OK the attribute data of a feature pointed to at screen, so what does it mean?
    1. Does it mean that there is no FeatureLayer "associated" with the SceneLayer, but the regular popup can work with attribute table of a SceneLayer with no associated FeatureLayer?
    2. Or does it mean that in my case the SceneLayer has a FeatureLayer associated with it, but the FeatureLayer widget has a "bug" that it does not know automatically to "communicate" with the associated FeatureLayer?
  7. Will the FeatureLayer widget automatically work OK with a SceneLayer which has an associated FeatureLayer?(display its attribute table, and sense if I click a feature on screen? and if I set the feature record checkbox "on" in the attribute table, will it still highlight that feature on screen?)
    Or must I send the associated FeatureLayer instead to the FeatureLayer widget in order to display its attribute table? Will it still work OK against the screen in such a case?
  8. If the SceneLayer does not have an associated FeatureLayer and I create the FeatureLayer from the url,
    will it be enough to "associate" it to the SceneLayer by my javascript for the FeatureLayer widget to work OK on the SceneLAyer?
    If not, then will the FeatureLayer widget work OK if I send to it the FeatureLayer? I mean - sense if I click a feature on screen? and if I set the feature record checkbox "on" in the attribute table, will it still highlight that feature on screen?

Thanks,

Michael

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Michael,

  Your make this way to complicated by overthinking things. A Scene layer is just another layer type. It has a URL thus that url can be used in a FeatureLayer constructor. JS API layer objects have a type property that can be used to evaluate the type of object it is.

I am not an expert on your exact scenario I am only providing a suggestion to get past your error about the layer being a scene layer.

I actually don't understand why it is have an error like that but it is likely due to the fact that FeatureTable is clearing indicated that it is still in beta release.

MichaelLev
Occasional Contributor III

Dear Robert Scheitlin, GISP‌,

I'm reading now in esri documents.

I understand that Only point, building, and 3D object scene layer types do have an associated feature layer.

So how can I detect by javascript if the sceneLayer is answering this condition?

Michael

0 Kudos