We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

5

You can put the colored polygons on top, with a layer blending mode set to darken Below, have the building layer with the polygon fill in white. At the bottom, add a new layer containing one large black polygon. Without the black background:


4

NetCDF can use compression, like a zip file, in order to decrease the storage size of redundant information. So if you have a global raster and all the land values are set to -9999 then the compression algorithm won't simply store a zillion -9999s, it will do something like "row 23 is 4.1,3.2,4.5,-9999 x 1000, 2.3, 4.5" - in those quote marks I've described ...


3

I managed to crop the GeoTiff file as intended. The issue was that my GeoJSON / shape / polygon had its points in "normal" coordinate reference systems (which actually is epsg:4326 or WSG 84) while my geoTiff data is expressed in epsg:32637. I used the following function to project my polygon: def project_wsg_shape_to_csr(shape, csr): project = lambda ...


3

The error occurs cause you did not rename the band to 'NDVI' and you did not use the actual variable containing the NDVI band (you are now using the original collection using 'S2collection.map(S2maskedVeg)'. You would (i think) best first define all you functions. Then apply them in the required order to your image collection, so the one where NDVI is ...


3

If you create a clipping layer with only the circular feature to use, your code can be simplified in this way (I use my own paths): from osgeo import gdal, ogr OutTile = gdal.Warp("/home/zeito/pyqgis_data/cut.tif", "/home/zeito/pyqgis_data/utah_demUTM12.tif", cutlineDSName='/home/zeito/pyqgis_data/boxes.shp', ...


3

You can do this by calling the same function on either slider change and then accessing the values from the slider directly from within the function which in this case i've named updateLayer var slider = ui.Slider({ min:-1, max: 1, step: 0.01, style: {stretch: 'horizontal', width:'500px'}, onChange: updateLayer }); var slider1 = ui.Slider({ min:...


2

If I understand correctly, this is what you need: var basemap = ee.ImageCollection([image5, image3]).max() var buff = seam.buffer(14000) var mask = ee.Image.constant(1).clip(buff).mask().not() var newBasemap = basemap.updateMask(mask) Map.addLayer(newBasemap, {}, 'newBasemap') I also made a public function for that var tools = require('users/fitoprincipe/...


2

The tool you are looking for is nibble. Nibble does exactly what you are asking for. Your work flow would be something along the lines of using your polygons to create a mask raster as the second input. Other related tools to consider (but probably not what you want for this use-case) are shrink and expand.


2

You are reinventing the wheel here. There is a function land.metrics in the spatialEco package that calculates point (radius) and polygon landscape metrics. The focal.lmetrics function facilitates moving window metrics. You could also take a look at the sample_lsm function in the landscapemetrics package. It is written in Rcpp so, is quite fast and efficient ...


2

First, what does mosaic? Composites all the images in a collection, using the mask. Returns: Image Since mosaic returns an image object, use this function at the end of the process, because if you removes clouds for a single image, you can't fill gaps. Apply mosaic.map(maskClouds) (as ImageCollection) instead maskClouds(mosaic) (as Image). But, is ...


2

Here's an alternate method for coloring the colored buildings to match the underlying zones. With Geometry Generator styling, create a separate symbol layer of buildings that intersect each of the zones. intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 1))) intersection($geometry, geometry(get_feature( 'zones', 'zoneNo', 2))) etc. Change ...


1

Try converting it using the Raster To Polygon tool which: Converts a raster dataset to polygon features. then you can use it as a Mask.


1

There may be many ways to do that, but when I had to do it I did: var maskInside = function(image, geometry) { var mask = ee.Image.constant(1).clip(geometry).mask().not() return image.updateMask(mask) } And put that function in a package (geetools for the code editor) that you can use in this way: var tools = require('users/fitoprincipe/geetools:tools'...


1

Add a field to your polygon attribute table Select the features/rows you want to be 0 Calculate as 0 using Field Calculator Switch selection and calculate as 1 Clear selection and convert to raster using Polygon to Raster tool


1

mosaic images setting nodata = 0 (or other value) should work, as masked areas will be transparent, being filled with other underlying images.


1

If like me you have inconsistency in the NA values in a rasterstack / brick, do the following: namask = sum('rasterbrick) new.rasterbrick = raster::mask('rasterbrick', namask) D


1

The Visibility tool supports a Mask environment setting, which does what you want: Tools that honor the Mask environment will only consider those cells that fall within the analysis mask in the operation. The mask can be a raster or a feature dataset. One can set the mask as an environment setting directly from the GUI or using the Python window: import ...


1

Your code tries to convert from EPSG:4326 to EPSG:4326. But your data is actually in EPSG:3857 (wild guess on my end). You need to use EPSG:3857 as "source" CRS. Try this (untested): project = lambda x, y: pyproj.transform( pyproj.Proj(init='epsg:3857'), pyproj.Proj(init='epsg:4326'), x, y ) yard = shapely.ops.transform(project, features) ...


1

This can be done by first defining a area in which you want to obtain the geometries of the red regions. I made a rectangle somewhere in the region you displayed the map. Then, you label every individual connected 'red' area with a different label using connectedComponents. You can then apply reduceToVectors and export those vectors for example as KMZ files ...


1

Masking should be done on images with zeros and ones. You just have to update the mask as you did previously when obtaining the loss image. A less than or greater than expression are generally used for the input of updateMask. var masked = img.updateMask(ltTrend.lt(0)); Here is how I adapted your code and added the masked and unmasked median composites to ...


1

For some raster stack with white (zero) borders, s: > plot(s) Note the first layer has no border, the second a wide border, and the third a narrow one-pixel border. Construct a list of trimmed layers, mm - note this is not a stack because the extents are now different: > mm = lapply(unstack(s),trim,values=0) Make a copy of s: > ss = s And now ...


1

I am not sure what will be the purpose of making a random mask, but it is actually possible inside the GEE. However, you are now combining some impossible things. Landsat images are projected in a rectangular grid, so around the globe they have different projections. Therefore, the masking of pixels is only possible correctly on an relatively small area on ...


1

Almost always there is a way. For such large operations it is best to export the results, for example to your asset. You will also have to set the maxPixels, in this case to the amount needed. I am not yet completely sure if it will finish, as this massive operation will take some time. You will have to try. Otherwise clip the image in multiple smaller ...


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