New answers tagged

1

Is there a way to merge image collections without the "system:index" properties being modified? No, it is not possible. This is because of two fundamental properties of Earth Engine collections: system:index values are unique within a collection (no two features have the same ID). Collections are processed in a “streaming” fashion: processing ...


0

While you can turn your subset* images to geometries with ee.Image.reduceToVectors(), you should try to avoid it. EE is a lot happier to work with images compared to complex geometries. I'm not completely sure I understood what you are trying to do here, but I think you want to mask your original image, clipdata3, based on your clusters. If so, you just need ...


0

Similar as you made a loop through the months to construct monthly NDVI images, you can do operations with images from the previous month. Try to avoid client-side for loops in the GEE. Here a modified example of your code indicating how to get the image of the previous month within the loop. I think it demonstrates how you can integrate that in your code ...


0

There are two problems in your approach. First, you are working wiht an ImageCollection and if you want to calculate LAI for a collection you need to apply a function using map(function). The second problem, you need to apply the funcion to a collection that already have an NDVI band, so apply it to collectionNDVI intead of sentinel_dataset. //Create LAI ...


0

I've been struggling with this too. What worked for me was doing the filtering on the s2SrWithCloudMask before you turn it into an imageCollection. I also made a filter function to map to the collection, so you can then filter by that. Code below. Keep everything you have, just add these bits in. This was converted from Python to JavaScript, there may be ...


0

You were almost there. ee.Reducer.count() returns the number of non-null pixels in your region at the scale you request the calculation occur. However, if you want the time series of soil moisture within your study area (geometry) you need to take the mean of all soil moisture values within it (and not count the number of pixels with non-null soil moisture). ...


0

It requires a bit more manipulation but in the end it worked : import rasterio as rio import numpy as np from matplotlib import pyplot as plt with rio.open(file) as f: data = f.read() bands = [] for i in range(3): band = data[i] #remove the NaN from the analysis # 3000 is the unit for landsat data change ...


1

Set the argument interpolateNulls of the options of the chart to true. By default, that is false. Make sure you put this argument before the series argument: // Create a time series chart. var TimeSeries = ui.Chart.image.seriesByRegion( times2019, city1, ee.Reducer.mean(), "NO2_column_number_density", 200, 'system:time_start', 'label') ...


0

If you want the difference you can subtract the two images (max and min) right away. This would work: var diff = max1.subtract(min); print(diff,"diff, max min"); However be aware that the bands won't be renamed like this.


6

You did not specify a scale, and provided a region whose coordinate system is in degrees. Thus, you got a very small image (2 × 1 pixels). If you specify a scale, you'll get an image: print(outImg.getThumbURL({region: pngArea, scale: 200, format: 'png'})); You can also specify explicit dimensions, but that may get you a distorted image if the dimensions don'...


0

You can simply use .and() For example var nvdi = (NIR.subtract(red)).divide(NIR.add(red)).rename('NDVI'); var filtered = nvdi.lt(0.75).and(nvdi.gt(0.35)); // to get between say 0.35 and 0.75 Map.addLayer(filtered,{min: -1, max: 1},'ndvi_rice_1'); // plot`


0

The ground distance of longitude fluctuates according to: 1º Longitude = cos(Latitude in º) * 111319.46 m (length of 1º at equator) so if you wanted to truly resample the dimensions of the pixels to match the graticule, the resulting pixels would be variable in size and non-square. However, when publications use decimal degree scales I think they usually ...


0

I now have an alternative to Earth Engine. I found that USGS EarthExplorer UI and their high-resolution-orthoimagery meet my resolution needs and is fairly easy to use (no script required) in comparison to Google Earth Engine that is designed for higher level analysis work.


2

You can make a feature collection (which is the type of data you can export as CSV in GEE) using the following. It will make a feature per year, and add the number of images for each collection (LS-5,7,8) also as a property. // Calculate the number of images for every year var listYears = ee.List.sequence(1982, 2020, 1); // map over the years, get ...


0

In training the classifier, you provided a list of ['name', and 'id']. From the docs: classProperty (String): The name of the property containing the class value. Each feature must have this property, and its value must be numeric. You must provide a string as input. I am unable to run your code due to not having access to the forest featurecollection, but ...


1

There are simply no images in 2015 for your defined filters (region, months and cloud percentage). You an check that using: var numbImages = ee.ImageCollection('COPERNICUS/S2') .filterDate('2015-06-23', '2015-12-31') .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)) .filterBounds(roi).size(); print('...


1

You have used the wrong variable. In the JavaScript version you have: var presence_samp = ee_dates.map(sample_from_collection) But in Python you wrote banded_images instead of ee_dates: presence_sample = banded_images.map(sample_from_collection) This accounts for the error because you are passing an image from a collection to code that expects a date.


0

Ordering of rows is not preserved when uploading tables, because the database they are stored in prioritizes efficient spatial lookups (e.g. which points fall within a region of interest such as a displayed map tile) and shuffles the rows as needed to achieve this. If you want a specific order for display or export, you must sort the collection by a property ...


1

I haven't tried running the code, but here are the translation mistakes I see. return ee.FeatureCollection(sequence(0).map(func_nyp).flatten()).filterBounds(geometry) should be indented one more level so that it is part of tile_geometry (in which sequence is defined) instead of part of tile (where sequence is out of scope). It also could be simplified by ...


1

You can first extract the individual features from the feature collection and find the intersections between them using: //extract individual features var f0 = buffered.filter(ee.Filter.eq("system:index", '0')); var f1 = buffered.filter(ee.Filter.eq("system:index", '1')); var f2 = buffered.filter(ee.Filter.eq("system:index", '2')...


0

It was just a small issue with the way you were calling in the random points. Try running this now, it should work fine. LINK //cloud mask function maskL8sr(col) { // Bits 3 and 5 are cloud shadow and cloud, respectively. var cloudShadowBitMask = (1 << 3); var cloudsBitMask = (1 << 5); // Get the pixel QA band. var qa = col.select('...


0

When you print a chart on the console, there is a button to the top right (red circle). Click on it to open a new tab. There is another button (red circle) that allows you to download the csv with the NDVI values per date:


5

The issue is that some of the S1 images in your collection are completely masked after clipping to the geometry of your study area. To fix, filter out those images after creating your original image collection (adapted from this post): var s1Collection = s1Collection.map(function(img){ // unmask each image in the collection var unmasked = img.unmask(-99)....


1

When you have an image and you want data from specific points in it, the tool is ee.Image.reduceRegions. It works for any sort of region, not just points, so you have to specify a reducer to reduce the entire area of the image, but when you want points you can just pick a reducer like ee.Reducer.median() or ee.Reducer.first() and you'll still get the ...


1

Because you specified items: Object.keys(pixelClass), the values that the ui.Select has are the names in pixelClass. In order to get the values of pixelClass, you need to look up the name in pixelClass. onClick: function getValue(){ print(pixelClass[classSelector.getValue()]); }


1

Unlike Export.image.toDrive, image.getThumbURL does not need the additional step of clicking "Run". Documentation for that is at the end of the page here. So use I suggest you use mosaicImage.toByte().getThumbURL(), and print the URL to the right panel, which will let the users to click and see the image. Keep in mind that unlike the Export.image....


0

Follow the steps given on this page: https://developers.google.com/earth-engine/guides/service_account Most importantly "Register the service account to use Earth Engine" so what you have to do is register "cloud-service...iam.gserviceaccount.com" (i.e., your service _account) via this link: https://signup.earthengine.google.com/#!/...


2

ee.Geometry.cutLines can do this, but with some extra steps: It takes a list of cut distances, so you'll need to construct that; luckily ee.List.sequence is just the thing. Since it returns a single MultiLineString geometry, you'll need to do .geometries() after to split it up. var lines = ee.FeatureCollection( lineString.cutLines(ee.List.sequence(0, ...


1

You can define the argument properties to do that. See the explanation GEE provides in the documentation on sampleRegion(): properties (List, default: null): The list of properties to copy from each input feature. Defaults to all non-system properties. An example would be: // define sample image and feature collection var sampleFeatCol = ee....


1

Simply remove the features with property value 0 using var test = test.filterMetadata("UKCount","not_equals",0) Link to corrected code.


1

I figured it out. A mapping function can extract this information and place it in a separate dataframe var getCentroids = function(feature) { return feature.set({centralPoint: feature.centroid()}); }; var IraqCentroids = Iraq.map(getCentroids); print("Central nodes", IraqCentroids); var IraqCentroids2 = IraqCentroids.map(function(f) { var ...


0

Following @Kevin Reid accepted answer above, gee-comunity tool is likely the tool to convert EE-Javascript to Python source code. That gee-comunity tool mentioned Jiphy and stated that Jiphy is no longer supported. But Timothy ( creator of Jiphy ) has recently been pushing some commits to it. just tried out Jiphy, it doesn't convert a .js to a syntax-correct ...


0

The satellite is saved in the property system:index. You can acces it like this for a single image: var dataset = ee.ImageCollection('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS') .select('stable_lights'); print(dataset.first().get("system:index")) If you only want Images from the satellite F14 you can use filterMetadata print(dataset....


0

Looks like the COMP is the composite z-score AKA Integrated Forest Z-Score (IFZ). Computed as follows (from Huang et al, 2010, RSE): Where bi is any pixel from a band (b) and bi-hat is Where NB is number of bands used. https://groups.google.com/g/google-earth-engine-developers/c/g0mM92B4Y14/m/JVF5ve9_GQAJ There are still lots of unclear bits in the ...


0

This has been described under consideration section on the github page of rgee: The code before is perfectly valid but rgee will produce an error. This problem should be easily solved by adding the function ee_utils_pyfunc. It will permit to wrap R functions before to send it to reticulate. Try the following: library(rgee) ee_Initialize() addNDVI <- ...


0

It is the sum of decrease in Gini impurity index over all trees in the forest. From the comments in the code: /** * Variable importance. Every time a split of a node is made on variable * the (GINI, information gain, etc.) impurity criterion for the two * descendent nodes is less than the parent node. Adding up the decreases * for each individual ...


0

I figured it out. The changeProj() method in the ee.Image family of functions fixes my issue.


2

Yes, you can store an image (with one band or more) as a property, var image = ee.Image.constant(1); print(image.set('foo', image)); but this will not allow you to filter a collection on pixel values; every filter either includes or excludes the entire image based on simple value (string/number) or geometry characteristics, not pixels. If you want to remove ...


0

The following has a solution: Deleting close points from FeatureCollection using buffer in Google Earth Engine? var filterDistance = function(points, distance) { var filt2 = ee.List([]) var filt = points.iterate(function(el, ini){ var ini = ee.List(ini) var fcini = ee.FeatureCollection(ini) ...


1

You first spectra chart fails because the points are not within the image bounds, so the chart actually has no values. Make sure these point fall within the image pixels. For simplicity, I used: var points = ee.FeatureCollection.randomPoints(image.geometry(), 7); The second chart fails because you incorrectly define the argument seriesProperty as an list. ...


0

You can compute the distance using fastDistanceTransform(). See also here: // calculate the distance from the strem (in pixels) var thedist = streamImg.fastDistanceTransform().sqrt().multiply(ee.Image.pixelArea().sqrt()); See link


1

You can't reproject an ImageCollection. You can only reproject images. So your code would work like this: var S2_r = S2_f.first().reproject(proj, null, 10); If you want to reproject all images in the collection you need to map over the collection and reproject every single Image. var S2_r = S2_f.map(function(image){ return image.reproject(proj, null, 10); ...


0

This example script may answer your question- // Load a cloudy Landsat 8 image. var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20130603'); Map.addLayer(image, {bands: ['B5', 'B4', 'B3'], min: 0, max: 0.5}, 'original image'); // Load another image to replace the cloudy pixels. var replacement = ee.Image('LANDSAT/LC08/C01/T1_TOA/...


0

You can find the detailed information for Sentinel 2 Level-2A collection here: https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_SR#bands You can see that reflectance band's scale is 0.0001, which means that the value has been re-scaled using that factor. To get that value back you can simply multiply by the scale: var sentinelns = ee....


4

To display features in a collection with specific styling, use FeatureCollection.style. var table = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level2"); var styled = table .map(function (feature) { return feature.set('style', { fillColor: feature.getNumber('ADM0_CODE').format('%06x') }); }) .style({ styleProperty: '...


1

Is the GeoTools version used in GEE less recent than the one integrating this projection? Yes. If you have a need for this projection, you can request it at Google Earth Engine's issue tracker. Please make sure to describe how it would be useful to you; it would also be useful to mention that it is available in newer GeoTools.


1

sampleRectangle uses the input band's projection to determine the sampling resolution, and when you create a composite using .mean(), the result's projection is the default projection of WGS 84 with one degree scale, and your sampling area is much smaller than one degree. To fix this, override the default projection with the projection of one of the images; ...


0

unfortunately, the link doesn't work now. Here I found someone asked similar questions on researchgate: https://www.researchgate.net/post/is_google_eeflux_evapotranspiration_is_correct


3

For additional context on the slide referenced in the question, note that it is comparing using the Earth Engine Code Editor (a web IDE for developing against the Earth Engine JavaScript API) vs. using the Earth Engine Python API. The slide is from a presentation made over 3 years ago, and both the JavaScript and Python APIs have changed and the Code Editor ...


0

Please attach the whole script or at least add your studyarea, otherwise we can't see the region you are working on and the error you are getting.


Top 50 recent answers are included