Skip to main content
20 votes

On a map of the globe that is 1920x1080px, how big would each pixel be?

Assuming you are talking about a map of the world in Mercator Projection, Something like this: Then, You should know that not all pixels will represent the same area. There is a large amount of ...
Hasan Mustafa's user avatar
12 votes

Counting number of unmasked pixels per image in collection using Google Earth Engine

To get to your end goal of filtering your clipped image collection by 10% or less cloud cover, I would write a function that: counts the number of unmasked pixels in the image counts the number of ...
korndog's user avatar
  • 1,058
9 votes
Accepted

How do I change the pixel size in GDAL without changing the extent?

Here's a quick script I put together to correct the cell size of a folder of GeoTiff rasters: import os, sys from osgeo import gdal from osgeo import gdalconst WorkingFolder = sys.argv[1] # first ...
Michael Stimson's user avatar
8 votes
Accepted

Calculate the average of neighbor pixels for raster edge

The easiest way is to combine numpy's NaN functions (in this case nanmean) and ndimage.generic_filter, like so: import numpy as np from scipy import ndimage m = np.array([[13, 21, 13, 8], ...
om_henners's user avatar
  • 15.7k
8 votes

Shifting existing points (Shapefile) to the center of raster pixels

Pretty similar to @Erik's answer, but will also work with older versions of QGIS: Run Raster pixels to points on your raster: Run Snap geometries to layer: Choose your original points as input ...
MrXsquared's user avatar
  • 34.5k
7 votes

Displaying row/column of point in raster using QGIS

You can use the "Value Tool" plugin for QGIS.
Francisco Galdames's user avatar
7 votes
Accepted

How big is a MODIS 250m pixel in reality?

Per https://lpdaac.usgs.gov/dataset_discovery/modis, the viewing swath width of MODIS is 2,330 km, thus a large portion of the image is off-nadir in some way. https://modis.gsfc.nasa.gov/about/...
SMiller's user avatar
  • 3,706
7 votes
Accepted

Changing pixel's dimension (raster) on QGIS

You can use Raster - Projections - Warp and set output resolution to 10:
BERA's user avatar
  • 73.8k
7 votes
Accepted

Shifting existing points (Shapefile) to the center of raster pixels

If you would like to try a pyqgis solution in the Python console, you can use the script below. First, paste the code block into a blank editor in the Python console. Next you will need to edit 2 ...
Ben W's user avatar
  • 21.7k
7 votes

Raster color is changed when clipped with a polygon in QGIS

I guess, it is an expected behaviour. QGIS changes the color scheme depending on min/max values of new raster. To keep the same scheme for the new raster: Right click on the former satellite image &...
Kadir ┼×ahbaz's user avatar
7 votes

Shifting existing points (shapefile) to the highest raster pixel value in 5m buffer

Here's an approach that will work, but whether it works for you is going to come down to the size of your raster dataset, which you haven't included in the question. First convert your raster data to ...
Tom Brennan's user avatar
  • 5,102
6 votes
Accepted

Setting pixel value from 0 to 10

Allow me to rephrase the question "change the pixel value from 0 to 10" as follows; if the pixel value equals 0, then change it to 10. if the pixel value is not 0, then keep the original ...
Kazuhito's user avatar
  • 30.9k
6 votes

Shifting existing points (Shapefile) to the center of raster pixels

I suggest you run pixels to points, which will give you the point grid centered to you raster cells and should attach the raster values to the points. If you need some information attached to your ...
Erik's user avatar
  • 16.4k
6 votes

Calculating the number of points per raster pixel

you could try the function raster pixels to polygons. With the output of that, run count points in polygons where you end up with a poly dataset that has a field indicating the count of point that ...
Aquamarine's user avatar
  • 1,176
6 votes

Raster color is changed when clipped with a polygon in QGIS

If this is something you do alot, you can also build a model to clip then apply a saved style: Export the style as a QGIS Layer style file Create a model which clip and then set the style using the ...
BERA's user avatar
  • 73.8k
6 votes

Finding maximum value on raster transect between two points using PyQGIS

You could do something like this: # get reference to project p = QgsProject.instance() # get raster layer raster = p.mapLayersByName('dem')[0] # using the linestring from your example linestring = ...
Matt's user avatar
  • 17.3k
5 votes
Accepted

Is it possible get pixel value with only PyQGIS and not GDAL?

Yes, it is possible to get pixel values without gdal; only PyQGIS. Easier way is with a QgsRasterBlock object. This is the code: layer = iface.activeLayer() #in my case, a 20x20 raster provider = ...
xunilk's user avatar
  • 30k
5 votes

Creating direction raster in QGIS

In theory this should be possible using either GRASS r.mapcalc or SAGA raster calculator. I'll assume you have a single origin point for this. However I've not been able to get this to work, but I'll ...
Steven Kay's user avatar
  • 20.4k
5 votes
Accepted

How import many raster in r?

Solution 1 Create a loop to iterate through files: library(raster) raster_files <- list.files(mypath,full.names = T) #use pattern = '.tif$' or something else if you have multiple files in this ...
aldo_tapia's user avatar
  • 13.7k
5 votes
Accepted

AWS Sentinel 2 incorrect cloudy pixel percentage

This a known anomaly - see anomaly #29 in the Sentinel 2 data quality report. https://sentinels.copernicus.eu/web/sentinel/missions/sentinel-2/data-quality-report
user107414's user avatar
5 votes
Accepted

Inverting values of raster file using QGIS

Thanks to Mr. Stimson I used the expression 1000-(raster layer) to get the inverted raster result. I chose 1000 because it didn't have to be an exact invert and I didn't want negative numbers. I ...
brink's user avatar
  • 820
5 votes

What does Zero pixel value in NDBI mean?

NDBI (like NDVI) is an index that can be useful to highlight built up areas, but it is not possible to use a single threshold to determine with 100% certainty if the observed land cover is built up. ...
radouxju's user avatar
  • 49.7k
5 votes
Accepted

Understanding raster units

You are specifying the raster width/eight in terms of pixel, not the pixel width/height in terms of meters, so if the raster width is 10, it means the pixel size will be vector extent width divided ...
JGH's user avatar
  • 42.1k
4 votes

How to count the number of pixels with a specific value of a .gif file in QGIS

Simpler and faster with gdalnumeric (gdal+numpy): import gdalnumeric raster_file = gdalnumeric.LoadFile("/path/to/file.tif") pixel_count = (raster_file == 1).sum() # for pixel value = 1 print(...
XavierCLL's user avatar
  • 380
4 votes

Rounding pixel values of raster in QGIS

Use Menu Processing / Toolbox / Round Raster: This algorithm rounds the cell values of a raster dataset according to the specified number of decimals.
Babel's user avatar
  • 71.6k
4 votes
Accepted

Blurring raster using ArcGIS for Desktop?

I would generate a new raster by right-clicking on the image in the Table of Contents and Data > Export Data. Then change the cell size to something much less detailed, e.g. 10m or 100m etc. to ...
Midavalo's user avatar
  • 29.7k
4 votes
Accepted

Measuring distances from each pixel center (in raster) to each point (in vector) in PyQGIS?

According to this question, How to calculate distance in meter between QgsPoint objects in PyQgis?, it's easy. You just need to return a QgsPoint with your function pixel2coord() : def pixel2coord(x,...
YoLecomte's user avatar
  • 2,895
4 votes

Inverting values of raster file using QGIS

Invert values with QGIS Raster Calculator: -1 * "yourRaster@1" + MAX("yourRaster@1") but MAX() is not working properly according to some QGIS Bugs Reports. Instead of MAX() put ...
Gabriel Asato's user avatar
4 votes

Counting number of pixels using ArcGIS Spatial Analyst?

You can try Zonal Statistics as Table: Summarizes the values of a raster within the zones of another dataset and reports the results to a table. I belive one of the outputs will be pixel Count (per ...
BERA's user avatar
  • 73.8k
4 votes
Accepted

Linear regression between every 3×3 pixels between two rasters using R

I assume that by "lapse rate" you mean the regression slope. You are essentially describing a focal regression and since there is no multivariate version of raster::focal, there is no canned way to do ...
Jeffrey Evans's user avatar

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