I have a vector layer for the GPS locations and a raster for the landuse/landcover. I've realized a supervised classification to classify the categories in the Lulc and a maximum likelihood classification (even though I do not know if this last step was useful).

The ideal would be to have a table with the number of location points found for each categories. Like this I can have a percentage, in which categorie ( ex forest) we found 56 locations so 21% for example.

Can anyone help?

1 Answer 1


Here is a Python solution:

import arcpy

shp = r'C:\temp\landcover.shp'

# Get a list of all the cover types
vals = [row[0] for row in arcpy.da.SearchCursor(shp, "cover")]

# Loop through unique cover values and calculate percentage of total
for val in set(vals):
    percent = float(vals.count(val))/float(len(vals)) * 100
    print "{0} {1}%".format(val, percent)

enter image description here

grassland 10.0%
urban 10.0%
deciduous 20.0%
conifer 60.0%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.