public static string GetAttributes(this AxMap map, int layerHandle, int shapeIndex) { string s = ""; var sf = map.get_Shapefile(layerHandle); if (sf == null) { return(s); } string name = map.get_LayerName(layerHandle); s += "Layer: " + name + "\n"; s += "Shape ID: " + shapeIndex + "\n\n"; var shp = sf.Shape[shapeIndex]; if (shp != null && map.ShapeEditor.IsUsingEllipsoid) { var type = shp.ShapeType2D; if (type == ShpfileType.SHP_POLYLINE) { s += "Length, m: " + map.GeodesicLength(shp).ToString("0.0") + "\n\n"; } if (type == ShpfileType.SHP_POLYGON) { s += "Perimeter, m: " + map.GeodesicLength(shp).ToString("0.0") + "\n"; s += "Area, ha: " + (map.GeodesicArea(shp) / 10000).ToString("0.0") + "\n\n"; } } s += "Attributes:\n"; for (int i = 0; i < Math.Min(sf.NumFields, 10); i++) { s += sf.Field[i].Name + " = " + sf.CellValue[i, shapeIndex] + Environment.NewLine; } return(s); }