New answers tagged

1

Issue is probably due to inappropriate upload of CSV file to your assets. In following image of your table, it can be observed there are not coordinates for whatever feature. In my case, however, where I uploaded original CSV to my assets, it looks as follows. Coordinates for each feature are present. So, additionally to your code lines, I created a ...


0

This worked for me: var srtm = ee.Image('USGS/SRTMGL1_003'); var slope = ee.Terrain.slope(srtm); var scale = srtm.projection().nominalScale(); print('SRTM scale in meters', scale); print('Projection, crs, and crs_transform:', srtm.projection()); var x= ee.FeatureCollection('ID'); Map.addLayer(x); var elevregion= srtm; var slopecountry= ...


1

The property name seems to have a U+FEFF "Byte Order Mark" at the beginning of it, which is an invisible character some programs insert at the beginning of files (even though it really only means anything for the now-rare case of UTF-16 encoded text). Earth Engine does not strip this character, so the property name of the first column is not what ...


0

Not sure what the problem is, I ran the code without any issues.


3

I assume that "export" means to Google Drive. In this case, you can add following lines (complete code here) after line 31. // Apply your function to each item in the list by using the map() function => 31 line var squares = ee.FeatureCollection(list.map(computeSquares)).flatten(); //print(squares); // Export the FeatureCollection to a SHP ...


2

You can convert to a regular Javascript array and use Array.filter there. This will only work for ActiveList(). var topImage = Map.layers().getJsArray() .filter(function(f) { return f.getShown() }) .slice(-1)[0]


0

One of the counties has an extra linestring in the geometry. GeometryCollection type: GeometryCollection geometries: List (5 elements) 0: LineString, 2 vertices 1: Polygon, 727 vertices 2: Polygon, 3920 vertices 3: Polygon, 1778 vertices 4: Polygon, 3687 vertices Since there are different types of geometries ...


3

I suspect your issue is this line: var image = ee.Image( dataset.first() ); This reduces the Image Collection down to a single Sentinel 2 tile, which could be completely outside your study area on the other side of the world. If you change it to var image = dataset.mosaic() you should be able to see values in map 4. If .mosaic() doesn't return satisfying ...


0

It is the whole code? If yes, there are some stuff missing: You have to define the image collection and visualization parameter. Take a look at this question: Google Earth Engine - get true color (RGB) of Landsat 8 SR There is a complete snippet for Landsat 8 you can use.


5

Map.addLayer is client-side. Whether the image computation evaluates to null is server-side. So you need to bridge the gap by asking for the value to be computed: image.evaluate(function (imageInfo) { if (imageInfo) { Map.addLayer(image); } }); Note that this will also do nothing if there was an error computing the image collection for any reason; ...


1

If you want to have simultaneously class names and sums in your final result, you have to map roi_stats with a function able to retrieve class names from corresponding list by using indices obtained from values class list. Following script can do that where I created an arbitrary roi area (you don't provide one) that encloses your point (103.667, 11.5019). //...


1

First, you should watch product description here. There, you can observe it is a monthly product, not daily, with a scale of 0.1 (in ºC). So, between '1995-01-01' and '2021-01-01' (your dates) must have 312 images; as effectively I could corroborate. So, you can export directly your data to Google drive with a different function. In following script, I used ...


1

As per the documentation, a feature collection is a collection of features, and not a collection of geometries. If you would like to combine geometries into a feature collection, first convert each geometry into a feature using var features = geometries.map(function(g){ return ee.Feature(ee.Geometry(g)); }); Then, combine the features into a feature ...


1

I noticed a few things. (1) To clip over an ImageCollection, you need to use the map function; (2) your function was written incorrectly. I reproduced your code using an arbitrary geometry. Hope this helps! // Load the region of interest var geometry = /* color: #98ff00 */ee.Geometry.Polygon( [[[102.7313828161343, 15.766103402947243], [102....


3

.geometry() has to compute a single large geometry that is a union of the features' geometries. I suggest starting by selecting only the features from lmic that might contribute to containing in_geom: lmic.filterBounds(in_geom).geometry().contains(in_geom) That way, any features in lmic that definitely don't intersect in_geom won't be added to the union, ...


3

If you're trying to download a bunch of images cropped to your region, and that region is larger than about 1000x1000 pixels, then that method is roughly as good as anything else. It's generally a bad plan to mix client-side objects (numpy/pandas) and server-side objects (ee.Image, etc), but if that's all the more computation you're doing it's probably not a ...


4

Most likely, the image editing tools you are using are not expecting floating-point color channel (band) values, but integer. Floating-point color data is unusual outside of scientific (and sometimes game) computing, and many image editing or viewing programs do not support it. You can use Image.visualize to convert the image to RGB, in the same way that Map....


0

I think I found an error in the area chart: *// Create and print a histogram chart //Make time series of water pixels as area in km² within region var ClassChart = ui.Chart.image.series({ imageCollection: s1.select('waterMask'), region: aoi, reducer: ee.Reducer.sum(), scale: 100, })* I think the units are wrong. The units make sense for me in km2 if ...


3

The “percentage” value is the mask value. ee.Image.updateMask will replace an image's mask wherever it is not exactly zero (= fully transparent). So: var imageWithoutPartialMask = image.updateMask(1); (The 1 in this code is the new mask value; mask values are not actually stored as percentages but rather in the range 0.0 (transparent) to 1.0 (opaque).) Note ...


0

In case of MODIS, you can download the batch of tiles as this var batch = require('users/fitoprincipe/geetools:batch') var collection = ee.ImageCollection('MODIS/006/MOD13A1') .filterBounds(haryana) .filterDate(startDate, endDate) .select('NDVI') var count = collection.size() var ...


2

You should be able to set a common crs in both reproject() calls. Since I don't know where exactly your study area is you can use a global coordinate reference system like WGS84 with the EPSG Code 4326. Alternatively you can look up the UTM Zone of your study area and get a more local EPSG code. # Clip AAFC and plot AAFC_region = AAFC.clip(region) ...


2

About the "wrong" scale you get when you call nominalScale(): The mistake you are making is getting the scale of the mosaiced ImageCollection and not of an unaltered Image in the ImageCollection. Mosaicing the collection returns a different object which is calculated on the fly by Earth Engine using the default projection WGS84. This object has a ...


0

You can try for loop as below. You can also rename band and select specific band to print. var vci_list = []; for(var j = startyear; j <=endyear; j++){ for(var i = startmonth; i <=endmonth; i++) { var current = monthlyNDVI.filterMetadata('year','equals',j) .filterMetadata('month','equals',i) ....


1

I don't know what is your source but, I calculated total population preserving scale and result was 6308,113,647.54873. Following script calculates total population by country and it corroborates if scale was preserved. Sum was calculated in GEE console editor and it was also corroborated in a spreadsheet by using obtained CSV. var worldPop = ee....


4

You cannot use resample on a composite image. ee.Image.resample(mode) An algorithm that returns an image identical to its argument, but which uses bilinear or bicubic interpolation (rather than the default nearest-neighbor) to compute pixels in projections other than its native projection or other levels of the same image pyramid. This relies on the input ...


2

There are no tabs in the UI interface, but you can do split panels, which might help. var panel1 = ui.Panel([ui.Label("This is panel 1")]) var panel2 = ui.Panel([ui.Label("This is panel 2")]) var split = ui.SplitPanel(panel1, panel2, "vertical") ui.root.insert(0, split) https://code.earthengine.google.com/...


2

There is no Math prefix in an expression. It's just log(n).


0

I haven't figured out why GEE is coding masked pixels as NA when using the mean() reducer and as 0 when using the max() reducer but a work around can be found in this thread: https://stackoverflow.com/questions/36960974/how-to-replace-raster-values-less-than-0-to-na-in-r-code/49159943. I edited my code to set the masked values to 20000 using the unmask() ...


1

To achieve what you want, you'll need to create a new image containing the "ID" of your polygons: var feature_collection = ee.FeatureCollection(feature_geometry).set('ID', ee.List.sequence(1, 106)); var id_band = myPoly.reduceToImage({ properties: ['FID'], reducer: ee.Reducer.first() }).rename('ID'); Then, you will need to add this image ...


3

You can use following lines instead. var countries = ee.FeatureCollection("FAO/GAUL/2015/level0"); var names = countries.aggregate_array('ADM0_NAME'); var keys = ee.Dictionary(names).keys(); print(keys); var values = ee.Dictionary(names).values(); print(values.sort()); After running them in GEE code editor, you will get names of countries as ...


4

The variable lulc1 is an image collection with 5 elements (images between years 2015 and 2019). If you want to reclassify it, it is preferable to map entire collection with a function. Following code fix up your issues and add your image collection to the Map View of GEE. // lulc var lulc1 = ee.ImageCollection("COPERNICUS/Landcover/100m/Proba-V-C3/...


2

Sentinel 2 data is distributed as granules (tiles) that are 100x100 km2 ortho-images in UTM/WGS84 projection (source). Because the satellite path is not aligned with axes of the UTM projections, the tiles along the satellite path edge appear as triangles or trapezoids. The following script visualizes the boundaries of the S-2 granules imaged on a single day. ...


-1

Quite normal. Lots of them are slivers. If you get the data from SciHub https://scihub.copernicus.eu/dhus/#/home, you can see the shape of the raster that will be downloaded. Sometimes they're square, sometimes they're triangles.


2

Although the use of for-loops is discouraged in Earth Engine, this is one of situations where it can be useful. On the other hand, your above code snippet is not very useful. It is necessary complete code in your previous question. However, it produces 250 images for complete Image Collection. So, I'm going to display only ten of them in the for-loop (with ...


1

suggesting that this is a mixup between client-side and server-side Indeed. perturb.toa_Radiance contains several calls to print(). Since print is a function that itself sends a request to the EE servers, it cannot be used inside a map() — the mapped-over function parameter doesn't exist yet, which produces the error you see.


5

GLDAS products have images with climatic elements for each three hours so, you will have 8 values per day of temperatures. In this case, you need to map your temperatures list for slicing each eight values. In these slices, you can apply a min reducer for minimum temperatures and a max reducer for maximum temperatures. However, produced temperatures list ...


0

That is a limitation with GEE. More details and code are provided here in this regards: https://un-spider.org/advisory-support/recommended-practices/recommended-practice-drought-monitoring-spi/step-by-step


3

I know that you are implementing literally the code for ui.Chart.image.seriesByRegion from this link. For this reason you have two issues in your code. First one: you need to scale images for obtaining true values for NDVI. Second one: your feature collection doesn't have a 'label' property (each feature needs one with name of each state). So, as I don't ...


2

I used some extra lines to simplify your geometry and your error is gone However, a new error occurred which I don't know how to solve: Image (Error) User memory limit exceeded . It's not the perfect solution but firstly try the code below to reach the next error. // Get a feature collection. var featureCol = ee.FeatureCollection(veredas); // Simplify ...


3

You can do that by mapping entire collection with function (s2SRMasked) of following script. There it was used an arbitrary point geometry because you didn't include one. var geometry = ee.Geometry.Point([-109.647021484375, 39.40057454539126]); var cld = require('users/fitoprincipe/geetools:cloud_masks'); var s2SR = ee.ImageCollection('COPERNICUS/S2_SR') ...


1

Standard regular expression syntax uses . to mean "any character". Use \. to refer to a literal period — and since it's quoted as a string you have to double the backslash for that. var regex = '\\.';


3

Following code produces a paired list of dates and daily precipitation values for exporting to Google Drive (for your filterCountry variable) and print a chartDaily for the same region. var startDate = ee.Date('2018-01-01'); var endDate = ee.Date('2021-01-01'); // Specify Country names var worldcountries = ee.FeatureCollection('FAO/GAUL/2015/level2'); var ...


3

The purpose of 'cloud transform' is to estimate projection of cloud shadows based on cloud position and sun azimuth. Or, as the author specifies it // Project shadows from clouds for the distance specified by the CLD_PRJ_DIST input. Then, if you want to display the cloud-free image, you need to apply all those masks using apply_cld_shdw_mask() function. Here ...


1

"Computation timed out" literally means that the computation took too much time. It does not refer to any limit on pixel counts or other quantities than time. If you believe your script is functioning correctly and simply is doing a long computation, then it's time to switch to using Export operations, which are allowed to run for days, to produce ...


1

If the weighting is linear against some thresholds, then you can probably do something like this: // Binary thresholds var result = ee.Image().int() .expression("term1 * 0.3 + term2 * 0.5 + term3 * 0.1", { term1: slope.lt(3), term2: evi.gt(0.6), term3: dataset.eq(10) }) If the terms are continuous instead, then just ...


2

You cannot aggregate pixels without specifying some region, either implicitly or explicitly. Just specify the whole world (as a non-geodesic polygon) and use it as a region in the reduceRegion call. var WORLD = ee.Geometry.Polygon([-180, 88, 0, 88, 180, 88, 180, -60, 0, -60, -180, -60], null, false)


0

For more Points use this tool: https://landsat.usgs.gov/landsat_acq#convertPathRow


2

Following code prints in your csv table the coordinates of centroids as centroid_x, centroid_y (one column for each coordinate). I hope this helps. // set of points var pointList= ee.List( [[-133.49345223488783, 28.4392489430013], [-134.28446785988783, 27.273691218174367], [-135.73466317238783, 27.351783369494303]]); // turn them ...


2

Your above code produces 190 images every 16 days so, it works well with 12 frames per second. However, for an animation once a year between 2013-2021, a lower value for this parameter is required because there are only 9 years in obtained image collection (years). In following code, I used only 1 frame per second and it works well. As said before, yearly ...


1

I created in GEE, two LineString and one Polygon geometries and put them together in one Feature Collection. They look, printed in GEE, as follow. When I tried to export this Geometry Collection in that way, I got your same error message. However, when I filtered each geometry by type, as in following script, I could export successfully each feature ...


Top 50 recent answers are included