Hi, I need to get the area from a shapefile, this has the area in its attribution table, but I need it as a double.
I've tried to convert the shapefile into a graphic but I don't know-how. This in order to work with the graphic library and calculate the areas.
Thanks!
Erick Morris
Student of petroleum engineer.
Solved! Go to Solution.
oh also just realized that your where clause will probably mean you don't get any features back, as the where clause looks for rows that's returns true on that expression. Try setting the WhereClause to "1=1" which would make all rows match the filter and you get them all back.
If your dataset also have an AREA attribute (like your screenshot seem to indicate), you can read that using
feature.Attributes["AREA"]
Hi,
A Shapefile is a collection of features, which means you might be asking one of several questions depending on what you're trying to achieve.
- The area of each individual feature?
- The combined area values of all features?
- The area of the rectangular extent encompassing all features?
- The area of the smallest polygon encompassing all features?
In all cases above you should be able to follow sample arcgis-runtime-samples-dotnet/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/FeatureLayerQuery at mas... and use ShapefileFeatureTable instead of the ServiceFeatureTable.
Thanks
Mike
Hi Mike, thanks for replying. Yes I understand you, 1 Shapefile has just 1 feature, I just need the area of that feature.
And also I need the Sum of all the areas from another shapefile, Thanks for the advice! any news I'll post right here.
Michael, I've tried to display the area of the feature, but I don't get anything, the following is the code that I've been using:
Also, here is the attribute table of the shapefile:
Have you tried using GeometryEngine.AreaGeodetic(feature.Geometry) ?
oh also just realized that your where clause will probably mean you don't get any features back, as the where clause looks for rows that's returns true on that expression. Try setting the WhereClause to "1=1" which would make all rows match the filter and you get them all back.
If your dataset also have an AREA attribute (like your screenshot seem to indicate), you can read that using
feature.Attributes["AREA"]