I'm a Swedish student styding a beginners course in GIS and I have a question. I'm working with a raster map and want to count the numbers of pixels/cells within an area in the map (a lake). Is this possible? The purpose is to calculate the area of the lake and I dont want to use the measure tool because the map isn't exactly projected.
Zonal Statistics as a table can count the number of pixels that fall within the feature. However, you should still project the lake (polygon) and the raster to the same coordinate system and be sure they overlap.
Zonal Statistics as a table can count the number of pixels that fall within the feature. However, you should still project the lake (polygon) and the raster to the same coordinate system and be sure they overlap.
Thanks for your answer och tip! However I didn´t managed to count all pixels within the lakes border. The lake is not a polygon but a part of the raster map. But perhaps you ment that I should convert to polygon? I would like a tool how can delimit an area within a raster map and count the number of pixels within the area. In that case I'll could manually draw a line around the lake and get the the number of pixels as an outcome. Is there a tool like that or is there even a better way to accomplish my objective? I haven't worked with raster that much.
If the lake is one value you could extract that portion of the raster by attribute and then make that particular raster the 'zone.' In the Zonal statistics tool, you can use a raster as long as it is an integer and the values for the zone are homogenous.
There is not just a simple tool you can freehand a graphic and any created tool like that will likely contain the same tools mentioned above.
Just an idea but couldnt you convert raster to polygon. Then dissolve all the polygons that make up the lake into one polygon and then use that as the feature in zonal statistics?
Have you performed any generalization to clean up the raster prior to converting it to polygons? Many of the outputs from the conversion are not what is intended if the raster is too variable, you create a lot of small polygons, which end up being more problematic than the original raster. Be sure to create a feature class instead of a shapefile to avoid the size limitation of a shapefile. I would recommend trying a subset of the raster and also trying some of the generalization tools to clean up the edges or perhaps reclass the raster into definitive areas prior to conversion.