Select to view content in your preferred language

SceneLayerView.queryFeatures() returns only objectID, no other fields, no geometry?

3404
13
Jump to solution
10-09-2017 08:26 PM
nie
by
Emerging Contributor

FeatureLayerView.queryFeatures() returns all the field values and the geometry, but using SceneLayerView.queryFeatures() I can get only the objectid.

0 Kudos
13 Replies
nie
by
Emerging Contributor

The process is similar, the difference is, each time the extent change I set a new renderer for the scene layer. Maybe overriding the getSymbol() is a better way, let me try.

Thank you for your reply, it really helped me a lot!

0 Kudos
RalucaNicola1
Esri Contributor

A bit late to the party, but here is some more information:

1. & 3. yes, the geometry property is `null` because the geometry of a SceneLayer is, like Thomas said, in a binary format. The closest you can get to a readable geometry format is to get its extent, which is a geometry extent: Extent | API Reference | ArcGIS API for JavaScript 4.5. You can then calculate the center point to place the popup.  

How did you publish the service? Sometimes popup info comes with the service, so you get the popup with all the attributes for free, and you don't need to configure anything. For example here. What is your use case? Do you want to trigger showing a popup by other action than clicking on the building?

2.  Getting attributes: the SceneLayer only downloads the objectId and the attributes that it needs for the renderer. If the SceneLayer has a linked FeatureLayer the SceneLayerView query will query the FeatureLayer for attributes directly. If it doesn't have a linked FeatureLayer then the SceneLayerView query will still make a request to the server, but this time to get the attributes stored in the cache of the Scene Service. I know this is a bit confusing as the queries on the LayerView should be client-side. We are working on a guide topic that hopefully will make these workflows more clear. They are different from the FeatureLayerView.

And about updating the renderer, yes, unfortunately that can't be done using standard solutions, thanks Thomas for providing that hack...

0 Kudos
nie
by
Emerging Contributor

I published the service from ArcGIS Pro, right click on the layer name and click 'Share As Web Layer'. Then three new service appeared in the REST Service Directory of ArcGIS Server, FeatureServer, MapServer and SceneServer.

I need to open the popup programmatically, so I need to do some query first and prepare the features and location for the Popup. I have tested and successfully opened the popup window by using FeatureLayerView.queryExtent().

Thank you for explaining the mechanism to me. Both of you are so kind~

0 Kudos
RalucaNicola1
Esri Contributor

ok, in this case I guess queryExtent is the best way to get the location of the popup. Happy to hear that it worked.

0 Kudos