Selecting Points within Area using Google Earth Engine?Selecting every image of collection using Google Earth Engine?Mean per district - Google Earth EngineArea error in Google Earth EngineGoogle Earth Engine - Map.addLayerSelecting n-random points within polygon as single feature in Google Earth Engine?Google Earth Engine, how to distinguish between rivers/streams and ponds/lakes in a water maskPython script tool fails when processing rainfall data from Google Earth EngineIntegrating Google Earth historical imagery within Google Earth EngineSelecting parameters for visualization in Google Earth EngineReducing arrays within arrays using Google Earth Engine?
What is the opposite of "eschatology"?
How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction
Does the Idaho Potato Commission associate potato skins with healthy eating?
Processor speed limited at 0.4 Ghz
Notepad++ delete until colon for every line with replace all
Why didn't Boeing produce its own regional jet?
What Exploit Are These User Agents Trying to Use?
Avoiding the "not like other girls" trope?
How dangerous is XSS
Unlock My Phone! February 2018
Is it a bad idea to plug the other end of ESD strap to wall ground?
In the UK, is it possible to get a referendum by a court decision?
How to prevent "they're falling in love" trope
What is a Samsaran Word™?
Is it possible to map the firing of neurons in the human brain so as to stimulate artificial memories in someone else?
Placement of More Information/Help Icon button for Radio Buttons
Do Iron Man suits sport waste management systems?
How does a dynamic QR code work?
Ambiguity in the definition of entropy
What is the fastest integer factorization to break RSA?
Different meanings of こわい
Why are UK visa biometrics appointments suspended at USCIS Application Support Centers?
Fair gambler's ruin problem intuition
How to install cross-compiler on Ubuntu 18.04?
Selecting Points within Area using Google Earth Engine?
Selecting every image of collection using Google Earth Engine?Mean per district - Google Earth EngineArea error in Google Earth EngineGoogle Earth Engine - Map.addLayerSelecting n-random points within polygon as single feature in Google Earth Engine?Google Earth Engine, how to distinguish between rivers/streams and ponds/lakes in a water maskPython script tool fails when processing rainfall data from Google Earth EngineIntegrating Google Earth historical imagery within Google Earth EngineSelecting parameters for visualization in Google Earth EngineReducing arrays within arrays using Google Earth Engine?
I have the following code in Google Earth Engine:
var dataset = ee.ImageCollection('MODIS/006/MOD14A1')
.filter(ee.Filter.date('2018-01-17', '2019-01-04'));
var fireMaskVis =
min: 0.0,
max: 6000.0,
bands: ['MaxFRP', 'FireMask', 'FireMask',]
;
Map.setCenter(6.746, 46.529, 2);
Map.addLayer(dataset, fireMaskVis, 'Fire Mask');
// coordinates to zoom to and get statistics from
var point = ee.Geometry.Point([2.3622940161999395, 42.569280018996714]);
Map.addLayer(AOI, , 'the area of interest');
Map.centerObject(AOI, 11);
var fire = dataset.select("FireMask");
// reduce the surface temperature image collection to a single image with stacked bands
function collToBands(imageCollection, bandName)
// stack all the bands to one single image
// change the name of the bandname to the date it is acquired
var changedNames = imageCollection.map( function(img)
var dateString = ee.Date(img.get('system:time_start')).format('yyyy-MM-dd');
return img.select(bandName).rename(dateString);
);
// Apply the function toBands() on the image collection to set all bands into one image
var multiband = changedNames.toBands();
// Reset the bandnames
var names = multiband.bandNames();
// rename the bandnames
var newNames = names.map(function(name)
var ind = names.indexOf(name);
return ee.String(names.get(ind)).slice(5);
);
return multiband.rename(newNames);
// apply the function and print to console
var multiband = collToBands(fire, "FireMask");
//print('collection to bands', multiband);
// get the temperature at a given point on the map for the given time spand and print to the console
var firePoint = multiband.reduceRegion(reducer: ee.Reducer.mean(), geometry: point, scale: 1000, bestEffort: true);
print(firePoint);
///// DO THE SAME OPERATION FOR MULTIPLE SPACED POINTS IN AN AREA OF INTEREST
// make a feature collection of many pixelsize-spaced points
function spacedPoints(AOI, proj)
// make a coordinate image
// get coordinates image
var latlon = ee.Image.pixelLonLat().reproject(proj);
// put each lon lat in a list -> this time for getting an multipoint list (more useful inside the GEE)
var coords = latlon.select(['longitude', 'latitude'])
.reduceRegion(reducer: ee.Reducer.toList(),
geometry: AOI,
scale: proj.nominalScale().toInt()
);
// zip the coordinates for representation. Example: zip([1, 3],[2, 4]) --> [[1, 2], [3,4]]
var point_list = ee.List(coords.get('longitude')).zip(ee.List(coords.get('latitude')));
// preset a random list
var list = ee.List([0]);
// Make a feature collection of the multipoints and assign distinct IDs to every feature
var feats = ee.FeatureCollection(point_list.map(function(point)
var ind = point_list.indexOf(point);
var feat = ee.Feature(ee.Geometry.Point(point_list.get(ind)), 'ID': ind);
return list.add(feat);
).flatten().removeAll([0]));
return feats;
// use function to get the spaced points
var points = spacedPoints(geometry, multiband.select(0).projection());
//print(points);
// add to the map
Map.addLayer(points.draw('red'), , 'the spaced points');
// calculate the temperature over the time span at every point in the AOI
var fires = multiband.reduceRegions(collection: points, reducer: ee.Reducer.mean(), scale: 10000);
I have a polygon called AOI
covering California, and I am trying to select points inside the polygon from a collection of points called geometry
. When I run the code, I get the following error:
the spaced points: Layer error: An internal server error has occurred (0c65b8234cd71e9738a03fdbf87e5acb).
I did see that when I tried to find data for one point, it worked. I think it might have to do with the number of decimal places I go to on the coordinates. In the geometry
points, the coordinates only go out to 4 decimal places, but with the single point I tested, it went out to 16 decimal places, and that worked.
Here is the link to the script in order to see the geometry
and AOI
imports:
https://code.earthengine.google.com/859fa14b852cf3aa852dbf654a2ed293
google-earth-engine
add a comment |
I have the following code in Google Earth Engine:
var dataset = ee.ImageCollection('MODIS/006/MOD14A1')
.filter(ee.Filter.date('2018-01-17', '2019-01-04'));
var fireMaskVis =
min: 0.0,
max: 6000.0,
bands: ['MaxFRP', 'FireMask', 'FireMask',]
;
Map.setCenter(6.746, 46.529, 2);
Map.addLayer(dataset, fireMaskVis, 'Fire Mask');
// coordinates to zoom to and get statistics from
var point = ee.Geometry.Point([2.3622940161999395, 42.569280018996714]);
Map.addLayer(AOI, , 'the area of interest');
Map.centerObject(AOI, 11);
var fire = dataset.select("FireMask");
// reduce the surface temperature image collection to a single image with stacked bands
function collToBands(imageCollection, bandName)
// stack all the bands to one single image
// change the name of the bandname to the date it is acquired
var changedNames = imageCollection.map( function(img)
var dateString = ee.Date(img.get('system:time_start')).format('yyyy-MM-dd');
return img.select(bandName).rename(dateString);
);
// Apply the function toBands() on the image collection to set all bands into one image
var multiband = changedNames.toBands();
// Reset the bandnames
var names = multiband.bandNames();
// rename the bandnames
var newNames = names.map(function(name)
var ind = names.indexOf(name);
return ee.String(names.get(ind)).slice(5);
);
return multiband.rename(newNames);
// apply the function and print to console
var multiband = collToBands(fire, "FireMask");
//print('collection to bands', multiband);
// get the temperature at a given point on the map for the given time spand and print to the console
var firePoint = multiband.reduceRegion(reducer: ee.Reducer.mean(), geometry: point, scale: 1000, bestEffort: true);
print(firePoint);
///// DO THE SAME OPERATION FOR MULTIPLE SPACED POINTS IN AN AREA OF INTEREST
// make a feature collection of many pixelsize-spaced points
function spacedPoints(AOI, proj)
// make a coordinate image
// get coordinates image
var latlon = ee.Image.pixelLonLat().reproject(proj);
// put each lon lat in a list -> this time for getting an multipoint list (more useful inside the GEE)
var coords = latlon.select(['longitude', 'latitude'])
.reduceRegion(reducer: ee.Reducer.toList(),
geometry: AOI,
scale: proj.nominalScale().toInt()
);
// zip the coordinates for representation. Example: zip([1, 3],[2, 4]) --> [[1, 2], [3,4]]
var point_list = ee.List(coords.get('longitude')).zip(ee.List(coords.get('latitude')));
// preset a random list
var list = ee.List([0]);
// Make a feature collection of the multipoints and assign distinct IDs to every feature
var feats = ee.FeatureCollection(point_list.map(function(point)
var ind = point_list.indexOf(point);
var feat = ee.Feature(ee.Geometry.Point(point_list.get(ind)), 'ID': ind);
return list.add(feat);
).flatten().removeAll([0]));
return feats;
// use function to get the spaced points
var points = spacedPoints(geometry, multiband.select(0).projection());
//print(points);
// add to the map
Map.addLayer(points.draw('red'), , 'the spaced points');
// calculate the temperature over the time span at every point in the AOI
var fires = multiband.reduceRegions(collection: points, reducer: ee.Reducer.mean(), scale: 10000);
I have a polygon called AOI
covering California, and I am trying to select points inside the polygon from a collection of points called geometry
. When I run the code, I get the following error:
the spaced points: Layer error: An internal server error has occurred (0c65b8234cd71e9738a03fdbf87e5acb).
I did see that when I tried to find data for one point, it worked. I think it might have to do with the number of decimal places I go to on the coordinates. In the geometry
points, the coordinates only go out to 4 decimal places, but with the single point I tested, it went out to 16 decimal places, and that worked.
Here is the link to the script in order to see the geometry
and AOI
imports:
https://code.earthengine.google.com/859fa14b852cf3aa852dbf654a2ed293
google-earth-engine
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with thebutton for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.
– Vince
2 days ago
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday
add a comment |
I have the following code in Google Earth Engine:
var dataset = ee.ImageCollection('MODIS/006/MOD14A1')
.filter(ee.Filter.date('2018-01-17', '2019-01-04'));
var fireMaskVis =
min: 0.0,
max: 6000.0,
bands: ['MaxFRP', 'FireMask', 'FireMask',]
;
Map.setCenter(6.746, 46.529, 2);
Map.addLayer(dataset, fireMaskVis, 'Fire Mask');
// coordinates to zoom to and get statistics from
var point = ee.Geometry.Point([2.3622940161999395, 42.569280018996714]);
Map.addLayer(AOI, , 'the area of interest');
Map.centerObject(AOI, 11);
var fire = dataset.select("FireMask");
// reduce the surface temperature image collection to a single image with stacked bands
function collToBands(imageCollection, bandName)
// stack all the bands to one single image
// change the name of the bandname to the date it is acquired
var changedNames = imageCollection.map( function(img)
var dateString = ee.Date(img.get('system:time_start')).format('yyyy-MM-dd');
return img.select(bandName).rename(dateString);
);
// Apply the function toBands() on the image collection to set all bands into one image
var multiband = changedNames.toBands();
// Reset the bandnames
var names = multiband.bandNames();
// rename the bandnames
var newNames = names.map(function(name)
var ind = names.indexOf(name);
return ee.String(names.get(ind)).slice(5);
);
return multiband.rename(newNames);
// apply the function and print to console
var multiband = collToBands(fire, "FireMask");
//print('collection to bands', multiband);
// get the temperature at a given point on the map for the given time spand and print to the console
var firePoint = multiband.reduceRegion(reducer: ee.Reducer.mean(), geometry: point, scale: 1000, bestEffort: true);
print(firePoint);
///// DO THE SAME OPERATION FOR MULTIPLE SPACED POINTS IN AN AREA OF INTEREST
// make a feature collection of many pixelsize-spaced points
function spacedPoints(AOI, proj)
// make a coordinate image
// get coordinates image
var latlon = ee.Image.pixelLonLat().reproject(proj);
// put each lon lat in a list -> this time for getting an multipoint list (more useful inside the GEE)
var coords = latlon.select(['longitude', 'latitude'])
.reduceRegion(reducer: ee.Reducer.toList(),
geometry: AOI,
scale: proj.nominalScale().toInt()
);
// zip the coordinates for representation. Example: zip([1, 3],[2, 4]) --> [[1, 2], [3,4]]
var point_list = ee.List(coords.get('longitude')).zip(ee.List(coords.get('latitude')));
// preset a random list
var list = ee.List([0]);
// Make a feature collection of the multipoints and assign distinct IDs to every feature
var feats = ee.FeatureCollection(point_list.map(function(point)
var ind = point_list.indexOf(point);
var feat = ee.Feature(ee.Geometry.Point(point_list.get(ind)), 'ID': ind);
return list.add(feat);
).flatten().removeAll([0]));
return feats;
// use function to get the spaced points
var points = spacedPoints(geometry, multiband.select(0).projection());
//print(points);
// add to the map
Map.addLayer(points.draw('red'), , 'the spaced points');
// calculate the temperature over the time span at every point in the AOI
var fires = multiband.reduceRegions(collection: points, reducer: ee.Reducer.mean(), scale: 10000);
I have a polygon called AOI
covering California, and I am trying to select points inside the polygon from a collection of points called geometry
. When I run the code, I get the following error:
the spaced points: Layer error: An internal server error has occurred (0c65b8234cd71e9738a03fdbf87e5acb).
I did see that when I tried to find data for one point, it worked. I think it might have to do with the number of decimal places I go to on the coordinates. In the geometry
points, the coordinates only go out to 4 decimal places, but with the single point I tested, it went out to 16 decimal places, and that worked.
Here is the link to the script in order to see the geometry
and AOI
imports:
https://code.earthengine.google.com/859fa14b852cf3aa852dbf654a2ed293
google-earth-engine
I have the following code in Google Earth Engine:
var dataset = ee.ImageCollection('MODIS/006/MOD14A1')
.filter(ee.Filter.date('2018-01-17', '2019-01-04'));
var fireMaskVis =
min: 0.0,
max: 6000.0,
bands: ['MaxFRP', 'FireMask', 'FireMask',]
;
Map.setCenter(6.746, 46.529, 2);
Map.addLayer(dataset, fireMaskVis, 'Fire Mask');
// coordinates to zoom to and get statistics from
var point = ee.Geometry.Point([2.3622940161999395, 42.569280018996714]);
Map.addLayer(AOI, , 'the area of interest');
Map.centerObject(AOI, 11);
var fire = dataset.select("FireMask");
// reduce the surface temperature image collection to a single image with stacked bands
function collToBands(imageCollection, bandName)
// stack all the bands to one single image
// change the name of the bandname to the date it is acquired
var changedNames = imageCollection.map( function(img)
var dateString = ee.Date(img.get('system:time_start')).format('yyyy-MM-dd');
return img.select(bandName).rename(dateString);
);
// Apply the function toBands() on the image collection to set all bands into one image
var multiband = changedNames.toBands();
// Reset the bandnames
var names = multiband.bandNames();
// rename the bandnames
var newNames = names.map(function(name)
var ind = names.indexOf(name);
return ee.String(names.get(ind)).slice(5);
);
return multiband.rename(newNames);
// apply the function and print to console
var multiband = collToBands(fire, "FireMask");
//print('collection to bands', multiband);
// get the temperature at a given point on the map for the given time spand and print to the console
var firePoint = multiband.reduceRegion(reducer: ee.Reducer.mean(), geometry: point, scale: 1000, bestEffort: true);
print(firePoint);
///// DO THE SAME OPERATION FOR MULTIPLE SPACED POINTS IN AN AREA OF INTEREST
// make a feature collection of many pixelsize-spaced points
function spacedPoints(AOI, proj)
// make a coordinate image
// get coordinates image
var latlon = ee.Image.pixelLonLat().reproject(proj);
// put each lon lat in a list -> this time for getting an multipoint list (more useful inside the GEE)
var coords = latlon.select(['longitude', 'latitude'])
.reduceRegion(reducer: ee.Reducer.toList(),
geometry: AOI,
scale: proj.nominalScale().toInt()
);
// zip the coordinates for representation. Example: zip([1, 3],[2, 4]) --> [[1, 2], [3,4]]
var point_list = ee.List(coords.get('longitude')).zip(ee.List(coords.get('latitude')));
// preset a random list
var list = ee.List([0]);
// Make a feature collection of the multipoints and assign distinct IDs to every feature
var feats = ee.FeatureCollection(point_list.map(function(point)
var ind = point_list.indexOf(point);
var feat = ee.Feature(ee.Geometry.Point(point_list.get(ind)), 'ID': ind);
return list.add(feat);
).flatten().removeAll([0]));
return feats;
// use function to get the spaced points
var points = spacedPoints(geometry, multiband.select(0).projection());
//print(points);
// add to the map
Map.addLayer(points.draw('red'), , 'the spaced points');
// calculate the temperature over the time span at every point in the AOI
var fires = multiband.reduceRegions(collection: points, reducer: ee.Reducer.mean(), scale: 10000);
I have a polygon called AOI
covering California, and I am trying to select points inside the polygon from a collection of points called geometry
. When I run the code, I get the following error:
the spaced points: Layer error: An internal server error has occurred (0c65b8234cd71e9738a03fdbf87e5acb).
I did see that when I tried to find data for one point, it worked. I think it might have to do with the number of decimal places I go to on the coordinates. In the geometry
points, the coordinates only go out to 4 decimal places, but with the single point I tested, it went out to 16 decimal places, and that worked.
Here is the link to the script in order to see the geometry
and AOI
imports:
https://code.earthengine.google.com/859fa14b852cf3aa852dbf654a2ed293
google-earth-engine
google-earth-engine
edited 2 days ago
PolyGeo♦
53.9k1781245
53.9k1781245
asked 2 days ago
GGamerGGamer
325
325
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with thebutton for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.
– Vince
2 days ago
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday
add a comment |
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with thebutton for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.
– Vince
2 days ago
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with the
button for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.– Vince
2 days ago
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with the
button for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.– Vince
2 days ago
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday
add a comment |
1 Answer
1
active
oldest
votes
As it turns out, I was using the wrong coordinate system in the collection of points, so when I reduced the region of the AOI to those points, the coordinates were way outside of the area. After fixing the coordinates, the script worked fine.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317279%2fselecting-points-within-area-using-google-earth-engine%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As it turns out, I was using the wrong coordinate system in the collection of points, so when I reduced the region of the AOI to those points, the coordinates were way outside of the area. After fixing the coordinates, the script worked fine.
add a comment |
As it turns out, I was using the wrong coordinate system in the collection of points, so when I reduced the region of the AOI to those points, the coordinates were way outside of the area. After fixing the coordinates, the script worked fine.
add a comment |
As it turns out, I was using the wrong coordinate system in the collection of points, so when I reduced the region of the AOI to those points, the coordinates were way outside of the area. After fixing the coordinates, the script worked fine.
As it turns out, I was using the wrong coordinate system in the collection of points, so when I reduced the region of the AOI to those points, the coordinates were way outside of the area. After fixing the coordinates, the script worked fine.
answered yesterday
GGamerGGamer
325
325
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317279%2fselecting-points-within-area-using-google-earth-engine%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please Edit the question to place the relevant code snippet in the body of the question (indented four spaces with the
button for legibility). Links fail over time, and the number of volunteers willing to follow links is smaller than the total.
– Vince
2 days ago
Your area is way too big to print such an amount of points and the input in the spacedPoints function should be a polygon, instead of the points you have as input now
– Kuik
yesterday