Preheat the oven to 350°F (175°C). Grease and flour a 9x13-inch pan or two 9-inch round pans.
In a large bowl, whisk together the flour, baking powder, baking soda, salt, cinnamon, ginger, and nutmeg.
2 cups all-purpose flour, 1 ½ teaspoons baking powder, 1 teaspoon baking soda, 1 teaspoon salt, 1 ½ teaspoons ground cinnamon, ½ teaspoon ground ginger, ¼ teaspoon ground nutmeg
In another bowl, whisk the granulated sugar, brown sugar, oil, eggs, and vanilla until smooth.
1 cup granulated sugar, ½ cup packed brown sugar, 1 cup vegetable oil, 4 large eggs, 2 teaspoons vanilla extract
Add the wet ingredients to the dry ingredients and stir until just combined.
Fold in the grated carrots, drained pineapple, nuts, and coconut if using.
2 cups finely grated carrots, ½ cup crushed pineapple, ¾ cup chopped pecans, ½ cup shredded coconut
Pour the batter into the prepared pan(s).
Bake for 35–40 minutes (9x13-inch pan) or 30–35 minutes (9-inch rounds), or until a toothpick inserted in the center comes out clean.
Let the cake cool completely before frosting.