cmv/cmv-app

Overriding feature spatial reference in Identify

Closed this issue · 2 comments

result.feature.geometry.spatialReference = this.map.spatialReference; //temp workaround for ags identify bug. remove when fixed.

This line was causing issues for us when using Identify on feature graphics that had a different spatial reference than the map. Removing this line has fixed the issue -- Can anyone confirm that this line is no longer needed?

@apatriz Here's the original discussion that led to that line being changed. I have not head of issue with that existing code since that time. Quite frankly, I forgot about it completely. 😄

Can you provide a working example of the issue you ran into so I can review, test and comment?

@tmcgee thanks for the response. Upon further inspection, there was another error in our code leading to incorrect spatial refs being set on features in a feature collection saved to portal. The feature collection had a layer definition with a spatial ref of 3857, whereas the features were saved with 4326.
Fixing this also solved the issue.

In any case, here are the steps to reproduce:

  1. create a FeatureLayer from a feature collection where the feature geometries are in a different spatial extent than the map
  2. add the FeatureLayer to the map
  3. perform an Identify on any feature graphic -> the line in question will override the graphic spatial ref
  4. zoom in/out (to trigger a redraw) -> the graphic will disappear