Select to view content in your preferred language

Flex: Get Graphic SHAPE.len Attribute

937
5
10-03-2011 07:12 AM
TylerWaring
Frequent Contributor
Greetigns Everyone,
           I am trying to work with the SHAPE.len field in the Flex Viewer so that I can serve up to date length data for a linear feature layer. I assumed that I could get it in the same way that I usually get attributes:

var nmLengthFeet:Number = graphic.attributes.SHAPE.len;

Seems not to be working though.

Any Ideas?

Best Regards,
Tyler Waring
Tags (2)
0 Kudos
5 Replies
KenBuja
MVP Esteemed Contributor
Since Shape.Len is an internal ArcGIS function, it's not an actual attribute that you can grab hold of. You'll have to create your own length field.
0 Kudos
TylerWaring
Frequent Contributor
I guess I'll have to make an update script then. Thanks for the tip.
Tyler
0 Kudos
ReneRubalcava
Esri Frequent Contributor
You can access the Shape.len field, but you'll need to use bracket notation since the "." won't translate over in code.
I tested this and it works with my SDE data.
var query:Query = new Query();
query.outFields = ["*"];
query.returnGeometry = false;
query.where = "AssetID  <> ' '";
var queryTask:QueryTask = new QueryTask("http://testgis/ArcGIS/rest/services/SewerSystemTest/MapServer/5");
queryTask.execute(query, new mx.rpc.Responder(function(features:FeatureSet):void {
 for each(var o:Object in features.attributes)
 {
  trace(o["Shape.len"]);
 }
}, function(fault:FaultEvent):void{ trace("error", fault.message); }));
0 Kudos
KenBuja
MVP Esteemed Contributor
Thanks for correcting me, Rene. I had forgotten about the fields in SDE.
0 Kudos
ab1
by
Deactivated User
I tried using attributes['SHAPE.LEN'] and it doesn't work for me.
0 Kudos