AnsweredAssumed Answered

Spatial Query with sceneLayerView

Question asked by mkohlerpsl on May 10, 2018
Latest reply on May 14, 2018 by mkohlerpsl

I'm trying to dynamically add graphics to a scene and have tried several things.


I have a scene in an app that shows the 3d buildings in the city. When the user loads the app, I want the buildings to be colored based on the attributes of a feature layer. The feature layer shows the status and type of group homes as a parcel. I want to loop over all the group homes and find the associated 3d building and change it's color and I'm running into trouble. I tried running a spatial query on the sceneLayer using the geometry and discovered this isn't possible. I then went to the 3d sceneLayer's associatedLayer and was still unable to get the .then functions to fire. 

     function colorHomes(){

          var bldg_lyr;
               if (nextLayerView.url.indexOf("Building") > 0){
                    bldg_lyr = nextLayerView.associatedLayer;

          //get all alf features
          var alfQueryTask = new QueryTask({ url: "..../rest/services/NS/ActiveALFsTest/MapServer/0" });
          var alfQuery = new Query({
               where: "1=1",
               outFields: ["NameFacility", "ADDRESS", "TypeFacility"],
               returnGeometry: true,
               outSpatialReference: view.spatialReference
               //loop over each feature
                    var bldgQuery = new Query({
                         geometry: alfFeature.geometry,
                         //objectIds: [13006],
                         outFields: ["OBJECTID"]
                    bldg_lyr.queryFeatures(bldgQuery).then(function (bldgResults){
                         if (bldgResults.length > 0){
                    function (bldgResults){
                         console.log("Ouch! That's gotta hurt.");