Select to view content in your preferred language

Create a list with a data expression that creates a buffer of an existing feature

142
1
Jump to solution
a week ago
Labels (1)
GIS_utahDEM
Occasional Contributor II

Hello! I am trying to create a data expression to populate a list in dashboards that reflects all the features of an existing featureset, but with a specific buffer around them. Mainly, I'm just not sure where in feature's attributes I can access/change the geometry and I'm having a hard time finding documentation about it. I currently have it on line 27 in the code below -- but I'm honestly not sure if that is where it would go OR if that would be the correct key to use.

 

var agol = portal('https://www.arcgis.com')
var layer = FeatureSetByPortalItem(agol,'0ca544f09ff94130b2685fbcbb7f89f1');

var recalc = {
  'fields': [{'name':'Name', 'type':'esriFieldTypeString'},
  {'name':'objectid','type':'esriFieldTypeOID'},
  {'name':'globalid','type':'esriFieldTypeGlobalID'},
  {'name':'Type','type':'esriFieldTypeString'},
  {'name':'Status','type':'esriFieldTypeString'},
  {'name':'Date','type':'esriFieldTypeDate'},
 // {'name':'search_date','type':'esriFieldTypeDate'}
  ],
  'geometryType': '',
  'features': []
}


for (var a in layer) {
  var new_a = {'attributes':{
    'Name':a.Name,
    'objectid':a.OBJECTID,
    'globalid':a.GLOBALID,
    'Type':a.Type,
    'Status':a.Status,
    'Date':a.Date,
  },
  geometry:Buffer(Geometry(a),50,'miles')
  }
    Push(recalc.features, new_a)
}

return FeatureSet(Text(recalc))

 

When I "Run" it, I get a table with the appropriate attributes, but no shape field
0 Kudos
1 Solution

Accepted Solutions
GIS_utahDEM
Occasional Contributor II

Well -- I solved my own problem and it actually does work for filtering and such on the map...but I'll keep it here in case someone else wants to see how I did it!

View solution in original post

0 Kudos
1 Reply
GIS_utahDEM
Occasional Contributor II

Well -- I solved my own problem and it actually does work for filtering and such on the map...but I'll keep it here in case someone else wants to see how I did it!

0 Kudos