Accessing Shape.STarea() from featuresetbyname

250
3
Jump to solution
02-05-2021 11:05 AM
LorindaGilbert
Occasional Contributor

Hi,

I'm attempting to pull data (shape.STarea()) from a map service in my web app using Intersects in arcade.  I've not found any reference to how to do this.  I'm only wanting to confirm that the data is what is to be used in the smart editor by way of testing.  I'm writing a FME script that does point in poly to grab this, but after the testing phase, I want to use the smart editor - no issue there.

I want to be able to pull this field thru as a custom expression in my feature access table.

current setup:

var fs = FeatureSetByName($map,"Parcels");
var pa = First(Intersects(fs, $feature));
var aeral = pa.shape.STarea();

return aeral;

Getting syntax error.

Any help would be appreciated.

Thanks,

Jazmateta

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Regular Contributor

In your script, the var aeral is a Feature type. If you look at the Arcade docs, you'll see that it has no property "shape" that can be accessed that way. If the name of the field you're trying to access is literally "shape.STarea()", you have to access it using brackets, like pa["shape.STarea()"], otherwise the dot in the middle will throw it off.

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Regular Contributor

In your script, the var aeral is a Feature type. If you look at the Arcade docs, you'll see that it has no property "shape" that can be accessed that way. If the name of the field you're trying to access is literally "shape.STarea()", you have to access it using brackets, like pa["shape.STarea()"], otherwise the dot in the middle will throw it off.

- Josh Carlson
Kendall County GIS

View solution in original post

LorindaGilbert
Occasional Contributor

Thanks Josh!

That was it!  I figured it had to do with the extra dot, and I tried with quotes and brackets, just not in the format you suggested.  It's working now.  Now to get it to speed up the data retrieval - but that is most likely due to pulling across servers and databases which I know that ESRI isn't fond of doing 🙂 .

Thanks again!

XanderBakker
Esri Esteemed Contributor

Hi @LorindaGilbert ,

From what I understand you have geometry stored in SQL Server and you want to access the area property of the geometry. In Arcade you can access attributes of features as mentioned by Josh or use the Area (https://developers.arcgis.com/arcade/function-reference/geometry_functions/#area ) or AreaGeodetic (https://developers.arcgis.com/arcade/function-reference/geometry_functions/#areageodetic ) functions to return the area of a geometry or feature. Be aware, since the precision of these functions depends on the view scale.

0 Kudos