3 votes

Finding the centroid of every pixel in a raster Python

You can accomplish this without the nested for loops by using np.meshgrid(). I think this will speed up your processing time as well, give this script a try: import rasterio import numpy as np import ...
user avatar
  • 2,536

Only top scored, non community-wiki answers of a minimum length are eligible