ImageryLayer Client Side chart using an uploaded shapefile

253
2
06-03-2021 01:59 AM
IGCMCGIS
New Contributor III

Hello Everyone,

We are writing with reference to the example of generating a client side chart for an image service as per the following sample (ImageryLayer - client side chart ).

Essentially we wold like to use this feature with an uploaded shapefile rather than a mouse event (click & drag).
We were referring to the following sample (Feature Layer from Shapefile ) where a a feature layer is created from an uploaded shapefile.

It seems the following snippet returns the feature layer and draws them on the map :

     var layers = featureCollection.layers.map(function (layer) {

              var graphics = layer.featureSet.features.map(function(feature){
                return Graphic.fromJSON(feature);
              })
              sourceGraphics = sourceGraphics.concat(graphics);
              var featureLayer = new FeatureLayer({
                objectIdField: "FID",
                source: graphics,
                fields: layer.layerDefinition.fields.map(function(field) {
                return Field.fromJSON(field);
                })
              });
              return featureLayer;
              // associate the feature with the popup on click to enable highlight and zoom to
            });
            map.addMany(layers);
 
Is it possible to use the layers output as outline to query the pixels and generate the fragmentation charts?
 
It seems that we might have to replace the followng event snippet in the createLandCoverchart() :
 removeChartEvents = view.on(["drag""click"], function (event) {
            if (pixelData) {
              event.stopPropagation();
              getFragCoverPixelInfo(event).then(updatefragCoverChart);
            }
          });
 
and then replace the whole buffer calculation for the circle graphic:
 removeChartEvents = view.on(["drag""click"], function (event) {
            if (pixelData) {
              event.stopPropagation();
              getFragCoverPixelInfo(event).then(updatefragCoverChart);
            }
          });
 
Please do let us know if this is possible and if there is a correct way to have this feature.
 
Thanks !:)
 

 

 

0 Kudos
2 Replies
IGCMCGIS
New Contributor III

It seems that the Feature Layer from shapefile adds a feature collection to the map. Considering that the featurecollection is a graphic like the buffer polygon within the following sample (ImageryLayer - client side chart ), is it possible to use the outline?

0 Kudos
IGCMCGIS
New Contributor III

Hello Everyone,

Just wanted to know if you could provide some insight on this capability and if something like this is possible. 

Thanks again!

0 Kudos