Hi all. Thank you for the help before. I successfully display a web scene with a building scene layer from the portal.
Now my next step is to render some icons indicating some spots in the view. I am trying to do it with the following steps:
1. Render the building scene layer and scene view.
2. Use buildingSceneLayer.when, get the fullExtent of building scene layer and trigger the functions below.
3. Map datas into new Graphic() items;
4. Create feature layer sourcing the graphic items, set the fullExtent as the object obtained from step 2 and set elevationInfo mode to be "relative-to-ground".
5. Add the feature layer into scene view by view.layers.add(featureLayer);
Problem I have:
The graphics displays correctly if I don't add the building scene layer. However it doesn't show up if I add back the building scene layer.
Again, I am sorry that I am not able to provide a workable repo due to security issue. Perhaps some sample code could help me out. Thank you for any help.
Solved! Go to Solution.
I have successfully rendered the feature layer. The solution was to set the same spatial reference as the web scene on all graphic objects when mapping data with Graphic class. I think the doc should explain more on how spatial reference works in the same project among different components. In this project, the feature layer does not required to have a spatial reference but the graphic object does.
Although I can't provide my full code, I can provide my coding structure for reference.
I was able to get your code here working by filling in some blanks where you have your own custom data. I am using a different spatial reference, but the only other key difference I had to make to get it to work was to change or remove the 'minScale' value you have set in the feature layer. In the code above, you have minScale set to 1, which is the same as your maxScale value. minScale, if set, should always have a higher value than maxScale. Is it possible that this is causing the issue you're seeing? As the code is now, it makes sense that the graphics in the feature layer would not be visible. See this section for more info.
I'd recommend removing minScale (so the layer's visibility is not restricted) and seeing if that resolves the issue. If not, please let us know and we can investigate further.
Hi. Thank you for the reply.
The spatial reference on the webscene was configured for the building scene layer so that it shows up. I can't use another spatial reference here.
I also tried to comment out maxScale, minScale and spatial reference when initializing the feature layer. With the building scene layer hidden, the icon displays correctly. But it disappears when any of scaling & spatial reference is configured.
I have successfully rendered the feature layer. The solution was to set the same spatial reference as the web scene on all graphic objects when mapping data with Graphic class. I think the doc should explain more on how spatial reference works in the same project among different components. In this project, the feature layer does not required to have a spatial reference but the graphic object does.
Thanks for the update, I can take a look through the documentation to see where some improvements could be made around this.