New answers tagged

1

You just need to declare the variable in the scope where you want it to be available (the entire makeDropdown), separately from assigning to it: function makeDropdown() { var newGeoLayer; // NEW ... // Dropdown menu var select = ui.Select({ items: dropdownItems.getInfo(), onChange: function(key) { var newGeo = states.filter(ee....


1

This is because VVFiltered_2016 is an ImageCollection, which is not exportable. You'll need to mosaic this together before you export. There are multiple ways to do that, but the simplest would be to call .mosaic() on the collection. // Export the image, specifying scale and region. Export.image.toDrive({ image: VVFiltered_2016.mosaic(), description: ...


1

First off, remember every time you call getInfo() that is a round trip to the server. So, if you are calling it more than once to get an answer - there is likely a better way. If I understand the question correctly, you are looking for the height and width of an image in pixels at the source resolution? If that is the case - this information is stored on ...


1

You are filtering the image on a simple time format, namely at 00:00 AM each day. The system:time_start property contain the exact sensing time. Therefore, first set a new date property to each image at 00:00AM: // set a date property to exactly 00:00 AM var image_2 = image_2.map(function(image){ return image.set('simpleTime', ee.Date(image.date().format('...


1

One way is to use this: //Suppose *NDVI* is your original NDVI var NDVI2 = NDVI.expression('b(0) < 0.2 ? 0.9 : b(0) > 0.5 ? 0.92 : 0.91') Update Based on your comments, one way is: var FSL= NDVI.expression('NDVI < 0.2 ? 0.92 : NDVI > 0.5 ? 0.99 : IndFV', { 'NDVI':NDVI, 'IndFV':fv.multiply(0.02644).add(0.96356)}); Hope it helps.


0

I have a problem using that answer. I would thank you If you could tell me what is wrong in my script: https://code.earthengine.google.com/43144b99eb7c14dbdc9bd3953a59dc46


0

You can perform time series analysis in Earth Engine. Please see this reference or this code lab. The second part of your question is more complicated. Images and collections are server objects (reference, tutorial). You can not mix them with third party libraries (such as pandas), although it is possible to request the data from Earth Engine and put it ...


1

Because Google Earth Engine data exports are asyncronous, the destinations are also cloud-based. Your options are Google Drive, Google Cloud Storage, or new assets in Earth Engine. Cloud Storage is generally the best option when it comes to exporting many files, as there is a handy command-line interface, gsutil to download (and upload) in bulk. But if all ...


1

You can't directly export it locally. According to https://developers.google.com/earth-engine/exporting#to-drive, You can export images, map tiles, tables and video from Earth Engine. The exports can be sent to your Google Drive account, to Google Cloud Storage or to a new Earth Engine asset. The easiest way is to export to drive, and then download ...


0

Your code should work, if you put the equation into the map function. And get the MEAN_SOLAR_ZENITH_ANGLE for every image you map over. // Normalize every band reflectance of the imagery var normal = sentinel2.map(function(img){ var zenith = img.getNumber('MEAN_SOLAR_ZENITH_ANGLE') // Apply equation: // ((0.0000006)*(zenith^3)) - ((0.0002)*(zenith^2))...


0

I am not 100 % sure if I have solved the complete issue as the resulting classification still seems weird to me but at least I managed to get rid of the error message. I think the issue was with the variable trainingSet. When I printed it, it was a featurecollection of: (1) a very weird looking MultiPolygon with many self-intersects and (2) a feature ...


1

Area and distance are best done in a projected coordinate reference system where the unit is meters instead of the degrees angle units of the default 'EPSG:4326' projection. You can define a similar function that generates a rectangle from a center point and x and y extensions, just do it in a projected CRS. The example below takes lat and lon as the center ...


2

In general, running a script twice should do the same thing each time. Therefore, the behavior you are observing is a bug. I have confirmed it myself and reported it.


0

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 pixels in the unmasked image calculates the percentage of masked pixels and sets this as a metadata property I would then map this onto your image collection and ...


1

If you are using the Python API, .getInfo() is necessary for printing and getting ee.Objects client-side because .evaluate() is not available [doc].


1

If I understand correctly, the code below could help: var properties = FCburn.first().propertyNames().sort().slice(0, -3) var col = ee.ImageCollection(properties.map(function(property) { return FCburn.select([property]) .reduceToImage([property], ee.Reducer.first()) .clip(borderB) .set('Date', ee.Date(ee.String(property).slice(0, 10).replace('...


1

That's a good question, I wondered the same thing. I am not aware that there is a pre-built function that accomplishes that. So for convenience I made a function myself, to retrieve the visualization parameters with the corresponding number as a dictionary from a collection. Here's how it works: function getVis(collection, number){ var visNumber = ee....


0

The covariance reducer works on lists of 1D Arrays. So this code should work: var a1 = ee.Array([1,2,3,4,5]) var a2 = ee.Array([5,4,3,2,1]) var cov = ee.List([a1, a2]) .reduce(ee.Reducer.covariance()) print(cov)


1

When you apply functions such as multiply() on an image, it loses its associated properties. Copy the properties of the original image to the new image: // Function That applies scaling factor function scale(image) { return image.multiply(1000000).set(image.toDictionary(image.propertyNames())) }


0

Your script has a few issues. The Error you are getting is because of this: //gfc2010 : global forest change in 2010 var gfc2010 = ee.Image(ee.ImageCollection("GLCF/GLS_TCC")) It tries to cast an ImageCollection to an Image, which doesn't work. Here's how you would fix that: //gfc2010 : global forest change in 2010 var gfc2010 = ee.ImageCollection("GLCF/...


1

ui.Map.Linker takes a list of maps. var linker = ui.Map.Linker(map1, map2, map3, map4); should instead be var linker = ui.Map.Linker([map1, map2, map3, map4]);


1

This is because "y2019SO2" is an image and you cannot map over an image. You should map over "y2019". I changed that part: // get the layer for the city var antalya = ee.FeatureCollection("FAO/GAUL/2015/level1") .filter(ee.Filter.or( ee.Filter.eq('ADM1_NAME', 'Antalya'))); Map.addLayer(antalya); Map.centerObject(antalya,7); // add image ...


1

This is most likely an issue with your version of the raster package and not with Google Earth Engine. Earth Engine is exporting the band names properly. Before version 3.0-8 (released around Dec. 2019) of the raster package, band names of GeoTiffs were lost when importing with stack(). See the resolved github issue here. Updating to a newer version of the ...


0

You can use map method over your S2 image collection to extract pixel values. Example code is below: var newft = ee.FeatureCollection(S2.map(function (img) { return img.sampleRegions({collection: pts, scale: 30, geometries: true}) })).flatten() Since each sampleRegions returns a feature collection, the outcome of the map function would be a collection of ...


2

The ifElse.neq is not a function error is because the object returned from ee.Algorithms.If() does not have an explicit type and therefore does not have a .neq method available to it as interpreted in the evaluation of the execution graph for your request. You need to cast the result as an ee.Image: var ifElse = ee.Image( ee.Algorithms.If(hasQC,...


1

Yes, you can create stacked bar charts with Earth Engine charting functions. I see your example is using a datatable, though the more common method would be to create one from a feature collection. Here is an example for a feature collection where each feature is an ecoregion zone and properties for each feature are 12 months of precipitation. /** * @...


0

You can make area line charts and line charts. Add the following code to the end of your script. It is important to sort the x-y observations by x (longitude in your case). Manually set the hAxis range using the viewWindow min and max parameters. To get a line chart, you need to hide the points and show the line using the pointSize and lineSize properties. ...


1

You can do it something like this: print(ui.Chart.image.series(before_SO2, antalya, ee.Reducer.mean(), 100)); print(ui.Chart.image.series(after_SO2, antalya, ee.Reducer.mean(), 100)); Have a look at the charts documentation for Google Earth Engine. You can find more examples there.


1

Assume water pixels have value of 2 in both flood image and everyday image. The example code below could help: flood_image = flood_image.eq(2) everyday_image = everyday_image.eq(2) difference_image = flood_image.subtract(everyday_image).selfMask() The first two lines assign value of one to water pixels, and zero to the rest. difference_image would have ...


2

It's not exactly the intended use, but you could use sampleRegions to handle generating a grid of points that overlap an image and a region of interest. You would have to calculate the meter scale that gets you the right point spacing in your projection. Map.addLayer(image.select(0).sampleRegions({ collection: ee.FeatureCollection([geometry]), scale: ...


1

Earth Engine does not offer an algorithm for finding routes along roads. The closest related feature that does exist is the cumulativeCost algorithm, but that is an image-space algorithm that will not be efficient for computing a path between only two points.


2

The issue is in the projection you are assigning the image for the export in Earth Engine. I could not get it to work with that projection either, but if I changed it to another they align as expect. You should export with a different projection, and then reproject layer if required. //// Export the data // Export table for plotting Export.table.toDrive({ ...


2

If you want to keep pixels that have a value of 15 or less than 15 and mask the rest of the pixels: var riverflow = ee.Image('WWF/HydroSHEDS/15ACC'); var flowAccumulation = riverflow.select('b1'); //Map.addLayer(flowAccumulation) var masked = flowAccumulation.updateMask(flowAccumulation.lte(15)); //Map.addLayer(masked) On the other hand, If you want to ...


2

For some unknown reasons, ui.Chart.array.values does not support LineChart. If you really want a line chart from your data, you can use ui.Chart.feature.byFeature instead. The example code below could be added to the end of your code. var fc = ee.FeatureCollection(ee.List.sequence(0, lon.size().subtract(1)).map(function(index) { return ee.Feature(null, { ...


0

Thank you for your kindness, Anyway I'm trying to use .clip(table) function to cut the table polygon however it's not working (quarterlyImages.clip is not a function). Could you please tell me how to adjust the code ? "print('image collection', quarterlyImages) print('startDates', quarterlyImages.aggregate_array('system:time_start')) print('sendDates', ...


1

Para mi tendrías que rescribir la ultima linea asi: var area = ee.Number(reducer.get('ndsi')).multiply(scale).multiply(scale).divide(1000000); print('area of ndsi ', area.getInfo() + ' km2');


1

I don't have your ROI, but I made another to make your code reproducible. Rather than using the sort() function, try instead setting a threshold percent cloud cover that you're happy with and remove all imagery that has too much cloud cover: var Sample = ee.Geometry.Polygon([ [[-119.22, 38.06], [-119.23, 37.97], [-119.01, 37.91], [-118.89, 37.93], [-...


0

My code stopped returning zeros, when I started masking with .updateMask() rather than .mask(). It seems that pixels masked by the latter are not excluded but counted as zeros in .mean() functions.


0

I find a solution: ee.Filter.contains() or ee.Filter.isContained(). var polys = /* color: #0b4a8b */ /* displayProperties: [ { "type": "rectangle" }, { "type": "rectangle" }, { "type": "rectangle" } ] */ ee.FeatureCollection( [ee.Feature( ee.Geometry.Polygon( ...


1

The returned object is an ee.Dictionary(). Get the single list values from the dictionary and plot these as follows: // subset the lists var lon = ee.List(VIIR2014List.get('longitude')) var avgRad = ee.List(VIIR2014List.get('avg_rad')) var chart = ui.Chart.array.values(avgRad, 0, lon ) See full link


4

it looks like you dont have a band named 'NDSI'. Try adding this code: var ndsi = medianpixelsclipped.normalizedDifference(['B3', 'B11']).rename('NDSI'); However, you need to make some changes in your code if you want to get the snow area. The Ndsi range is between -1 and 1; you are adding continuous values ​​in that range so it is perfectly possible to ...


1

The RGB-visualization of your images isn't working well and returning values which are way too big. Those big values are then interpreted as white. For videos I like to use .visualize(), since you can try out what it will look like immediately. You also needed to invert the band selection. Here's how it works (after my code the export function from your ...


1

I can't run the code because the table asset is not shared. However, I think you will need to cast ndwi1 as an ee.FeatureCollection() and then flatten() it. Mapping over the sorted image collection returns a collection of feature collections, which cannot be added as a Map layer. Replace your last two lines with this: var ndwiFc = ee.FeatureCollection(ndwi1)...


1

Something about the geometry argument in the reduceRegion function was not working with that particular VIIRS dataset (works okay with the vegetation index product - possibly a bug or something about the dataset's projection or bounds). I modified the reduction so that the geometry argument is updated according to the longitude bin, which works. // Load ...


0

As the errorMatrix function says:: errorMatrix(actual, predicted). So q1 is the feature collections (30% sample). One way to do classification and accuracy assessment is:: //suppose Train is 70% of the original dataset and Test is 30% of it. // and Image is our satellite image var Data = Image.select(bands).sampleRegions({ collection: Train, ...


1

There are multiple ways to make these composite image. Note that you will have to choose a manner to reduce multiple images within the three-month date range to one image. .first() is generally a bad choice. I would recommend .median() for simple composites: // get start and end date and define the number of quarterly composites var start = ee.Date('2013-01-...


1

Sorry, I can't read your code. Maybe you did not gave the permission. Try again! However, I already tell you that this normally happens when you don't have the same string in the FeatureCollection properties. Go to: Geometry Imports > Edit Layer properties. Here you chose "FeatureCollection" and edit the properties (name it as "class" and the value as "0")....


0

NASA organized an ARSET webinar on this topic some months ago. Please check this out: https://arset.gsfc.nasa.gov/sites/default/files/disasters/19-AdvSAR-2/SAR%20Disasters%20Part%201.pdf According to this document, the answers to your questions are the following: 1.1 IW Acquisition Mode 1.2 Polarizations VV & VH 1.3 They use ascending pass only 1.4 ...


2

var vectors = evi.addBands(evi).reduceToVectors({ reducer: ee.Reducer.count(), geometry: 'table3', crs : evi.projection(), scale: 1000, }); 'table3' is a string, not any kind of geometry. Since table3 is a variable, you shouldn't be quoting it. There are several other errors observable in your script once this is fixed — if you're having trouble ...


1

You are making one image (a composite median image) from a timeseries of images (an imageCollection). That single composite image cannot be plotted over time. You probably want to change these lines: s2 = s2.median(); s2 = getNDVI(s2).clip(studyArea); to s2 = s2.map(getNDVI); This appends an NDVI-band to every image in the timeseries. Clipping is not ...


Top 50 recent answers are included