Hot answers tagged

3

In Python, this would be: import gdal import osr driver = gdal.GetDriverByName('GTiff') spatref = osr.SpatialReference() spatref.ImportFromEPSG(27700) wkt = spatref.ExportToWkt() outfn = '/path/to/out.tif' nbands = 1 nodata = 255 xres = 5 yres = -5 xmin = 0 xmax = 680000 ymin = 0 ymax = 1240000 dtype = gdal.GDT_Int16 xsize = abs(int((xmax - xmin) / ...


3

Assuming your three rasters have the same dimensions, you can use numpy's boolean indexing to accomplish this. First, you need to create three masks, each one corresponding to one of your conditions: con1 = (dcl_array == 1) # raster a is 1 con2 = (dcl_array == 0) # raster a is 0 con3 = (tcd_array == 0) # raster c is 0 Then, you just have to index the ...


2

I would actually do this in reverse - create a raster from the vector provinces map, making sure you have aligned the rasters exactly, so each cell is associated with both a single province value and a single population density value. Once you have accomplished this, you can run the GRASS program r.univar which will give you statistics by the province cells,...


2

I think dpi matters. I presume you did the export via Project > Import/Export > Export Map to Image... wherein you can set the resolution (in dpi): calculating the dpi theoretically necessary: x * px/inch = px/m x = (px/m) / (px/inch) x = inch/m = 2.54cm / 100cm = 0.0254 So you would have to set the resolution to 0.0254 dpi. Unfortunately at least in ...


1

You can start by defining your colors as a dictionary, mapping value to color. Then turn it into an array of colors, where the index is the value, filling non-existing value with some default color. Finally, turn this into a palette string. Remember to set your min and max value too. // *Note*: this code block is all client-side JavaScript - no GEE objects ...


1

I did some steps and with the help of @nmtoken I was able to fix it. I believe that my raster table had some problems maybe because I created it with complex geometries or maybe another reason. This time I changed the raster table I just simply used this codes in PostGIS to create a raster table from a single polygon: SELECT ST_AsRaster(geom, 100, 100 , '...


1

Step 1: Go to https://search.earthdata.nasa.gov/search?q=SPL2SMAP_S Step 2: Select the tile that pops up Step 3: Filter granules by date and region Step 4: Select + Add to Project on right Step 5: Select My Project button that appears Step 6: Select More Options Step 7: Select Customize under Select Data Access Method Step 8: Under Reformat Output select ...


1

Popsum should be the sum of all the pixels which fall within the vector polygon. In your case, if each pixel represents population density, it should equal the population. The values in that column very roughly match the population of the provinces according to Vietnamese census data, so it appears to have worked generally properly.


1

So here is a full outline of my solution. It seems that the xyz. tiles have an odd formatting since the coordinates are not in the expected order and have a positive N-S pixel resolution. To fix the coordinates I first sorted the coordinates: for file in *.xyz; # sort coordinates do sort -k2 -n -k1 "$file" -o "$file"; done The positive N-S pixel ...


1

I would recommend a combination of geopandas and geocube. Here is some untested set of code that should get you pretty close to what you want to do. Step 1: Combine the shapefiles import pandas import geopandas gpd1 = geopandas.read_file("Shapefiles/shp1.shp") gpd2 = geopandas.read_file("Shapefiles/shp2.shp") gpd3 = geopandas.read_file("Shapefiles/shp3....


1

In QGIS 3.10.1 the developers put clipping of rasters in the Raster toolbar, in the Extraction section, it is now called "Clip Raster by Mask Layer". In the tool window there is an opportunity to select a CRS for input (or leave source CRS) and output rasters. Definitely works with different CRS: I clipped a raster in Projected CRS with a mask layer in ...


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