Extract Pixel Values for Multiple Polygons and Images Planned maintenance scheduled April...

Determine whether f is a function, an injection, a surjection

How to say 'striped' in Latin

What do you call the holes in a flute?

Mortgage adviser recommends a longer term than necessary combined with overpayments

Is there a documented rationale why the House Ways and Means chairman can demand tax info?

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

What loss function to use when labels are probabilities?

Estimated State payment too big --> money back; + 2018 Tax Reform

Can a monk deflect thrown melee weapons?

Estimate capacitor parameters

Choo-choo! Word trains

Stop battery usage [Ubuntu 18]

How do I automatically answer y in bash script?

Slither Like a Snake

Is there a service that would inform me whenever a new direct route is scheduled from a given airport?

Blender game recording at the wrong time

Jazz greats knew nothing of modes. Why are they used to improvise on standards?

When communicating altitude with a '9' in it, should it be pronounced "nine hundred" or "niner hundred"?

If I can make up priors, why can't I make up posteriors?

What is the largest species of polychaete?

Fishing simulator

Who can trigger ship-wide alerts in Star Trek?

Is drag coefficient lowest at zero angle of attack?

Cauchy Sequence Characterized only By Directly Neighbouring Sequence Members



Extract Pixel Values for Multiple Polygons and Images



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Extracting pixel values by points and converting to table in Google Earth Engine?Earth Engine convert list with coordinates and values into a feature collection for exportLooping ImageCollection and FeatureCollection together in Google Earth EngineExtract complete pixel values inside a geometryImporting GPS coordinates to extract multiple DN values in ERDASNDVI values for MODIS imagesGoogle Earth Engine. Looking for a way to have information for each location in the mentioned time period based on the non-cloudy layersAutomatically exporting time series of multiple polygons to .csvreduceRegions for multiple images at once?Extract complete pixel values inside a geometryExtract pixel values at given point dataset and if masked find the nearest pixel valueExtracting pixel values by points from multi-band image and converting to table in Google Earth Engine?How to extract values from metadata in sentinel 2 imagesExtract pixel number of Hansen lossyear map





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















I have 21 polygons and for each polygon I want to extract the pixel values inside them for Sentinel 1 images from 2017-01-01 to 2017-06-30.



The example below shows how this is done for one polygon. I want this for 21 polygons.
Extract complete pixel values inside a geometry



My expected output is a csv with columns polygon name, lat, lon, VH, VV and system:time start dates.



This is what I have so far.



//Location Data
var test= loc;
print(test);
Map.centerObject( test, 10);


// SENTINEL 1 DATA
var pol = ['VV', 'VH'];
//Load Sentinel1 image location around location 1
var Sentinel1= S1.filter(ee.Filter.eq('transmitterReceiverPolarisation', pol))
.filterMetadata('instrumentMode', 'equals', 'IW')
.filterDate('2017-01-01', '2017-06-30')
.filterBounds(test)
.select(['VH', 'VV'])
.filterMetadata('resolution_meters', 'equals' , 10).first();

Map.addLayer(Sentinel1, imageVisParam, 'single_image');
print(Sentinel1)

// generate a new image containing lat/lon of the pixel and reproject it to Sentinel1 projection
var coordsImage = ee.Image.pixelLonLat().reproject(Sentinel1.projection())
var joinedImage = coordsImage.addBands(Sentinel1);
print(joinedImage)

// extract lat/lon coordinates as a list
var newfc= test.map(function(feat){
var coords = joinedImage.reduceRegion({
reducer: ee.Reducer.toList(4),
geometry: feat.geometry(),
scale: 10

}).values().get(0)

coords = ee.List(coords)


//Export as CSV
var myFeatures = ee.FeatureCollection(coords.map(function(el){
el = ee.List(el) // cast every element of the list
var geom = ee.Geometry.Point([ee.Number(el.get(0)), ee.Number(el.get(1))])
return ee.Feature(null, {'VH':ee.Number(el.get(2)), 'VV':ee.Number(el.get(3)),
'Long':ee.Number(el.get(0)),'Lat':ee.Number(el.get(1))})

}))

return myFeatures
})

var table= newfc.flatten()

print(newfc);
print(table)

// Export the image, specifying scale and region.
// Export the FeatureCollection.
Export.table.toDrive({
collection: table,
description: 'TRIAL',
fileFormat: 'CSV'
});

//_____________________________________


Link to locations table: https://code.earthengine.google.com/?asset=users/rawailnaeem/test



Right now it is working fine for 1 image. I need this for each image in the imageCollection, not a mosaic image. So basically my question is how to loop this function over the entire image collection?










share|improve this question
















bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

    – Rodrigo E. Principe
    Sep 3 '18 at 20:48











  • @RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

    – Rawail Naeem
    Sep 4 '18 at 6:07











  • @RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

    – Rawail Naeem
    Sep 5 '18 at 10:41











  • Hi, sorry, I haven't had the time to look at it

    – Rodrigo E. Principe
    Sep 5 '18 at 18:42




















2















I have 21 polygons and for each polygon I want to extract the pixel values inside them for Sentinel 1 images from 2017-01-01 to 2017-06-30.



The example below shows how this is done for one polygon. I want this for 21 polygons.
Extract complete pixel values inside a geometry



My expected output is a csv with columns polygon name, lat, lon, VH, VV and system:time start dates.



This is what I have so far.



//Location Data
var test= loc;
print(test);
Map.centerObject( test, 10);


// SENTINEL 1 DATA
var pol = ['VV', 'VH'];
//Load Sentinel1 image location around location 1
var Sentinel1= S1.filter(ee.Filter.eq('transmitterReceiverPolarisation', pol))
.filterMetadata('instrumentMode', 'equals', 'IW')
.filterDate('2017-01-01', '2017-06-30')
.filterBounds(test)
.select(['VH', 'VV'])
.filterMetadata('resolution_meters', 'equals' , 10).first();

Map.addLayer(Sentinel1, imageVisParam, 'single_image');
print(Sentinel1)

// generate a new image containing lat/lon of the pixel and reproject it to Sentinel1 projection
var coordsImage = ee.Image.pixelLonLat().reproject(Sentinel1.projection())
var joinedImage = coordsImage.addBands(Sentinel1);
print(joinedImage)

// extract lat/lon coordinates as a list
var newfc= test.map(function(feat){
var coords = joinedImage.reduceRegion({
reducer: ee.Reducer.toList(4),
geometry: feat.geometry(),
scale: 10

}).values().get(0)

coords = ee.List(coords)


//Export as CSV
var myFeatures = ee.FeatureCollection(coords.map(function(el){
el = ee.List(el) // cast every element of the list
var geom = ee.Geometry.Point([ee.Number(el.get(0)), ee.Number(el.get(1))])
return ee.Feature(null, {'VH':ee.Number(el.get(2)), 'VV':ee.Number(el.get(3)),
'Long':ee.Number(el.get(0)),'Lat':ee.Number(el.get(1))})

}))

return myFeatures
})

var table= newfc.flatten()

print(newfc);
print(table)

// Export the image, specifying scale and region.
// Export the FeatureCollection.
Export.table.toDrive({
collection: table,
description: 'TRIAL',
fileFormat: 'CSV'
});

//_____________________________________


Link to locations table: https://code.earthengine.google.com/?asset=users/rawailnaeem/test



Right now it is working fine for 1 image. I need this for each image in the imageCollection, not a mosaic image. So basically my question is how to loop this function over the entire image collection?










share|improve this question
















bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

    – Rodrigo E. Principe
    Sep 3 '18 at 20:48











  • @RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

    – Rawail Naeem
    Sep 4 '18 at 6:07











  • @RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

    – Rawail Naeem
    Sep 5 '18 at 10:41











  • Hi, sorry, I haven't had the time to look at it

    – Rodrigo E. Principe
    Sep 5 '18 at 18:42
















2












2








2








I have 21 polygons and for each polygon I want to extract the pixel values inside them for Sentinel 1 images from 2017-01-01 to 2017-06-30.



The example below shows how this is done for one polygon. I want this for 21 polygons.
Extract complete pixel values inside a geometry



My expected output is a csv with columns polygon name, lat, lon, VH, VV and system:time start dates.



This is what I have so far.



//Location Data
var test= loc;
print(test);
Map.centerObject( test, 10);


// SENTINEL 1 DATA
var pol = ['VV', 'VH'];
//Load Sentinel1 image location around location 1
var Sentinel1= S1.filter(ee.Filter.eq('transmitterReceiverPolarisation', pol))
.filterMetadata('instrumentMode', 'equals', 'IW')
.filterDate('2017-01-01', '2017-06-30')
.filterBounds(test)
.select(['VH', 'VV'])
.filterMetadata('resolution_meters', 'equals' , 10).first();

Map.addLayer(Sentinel1, imageVisParam, 'single_image');
print(Sentinel1)

// generate a new image containing lat/lon of the pixel and reproject it to Sentinel1 projection
var coordsImage = ee.Image.pixelLonLat().reproject(Sentinel1.projection())
var joinedImage = coordsImage.addBands(Sentinel1);
print(joinedImage)

// extract lat/lon coordinates as a list
var newfc= test.map(function(feat){
var coords = joinedImage.reduceRegion({
reducer: ee.Reducer.toList(4),
geometry: feat.geometry(),
scale: 10

}).values().get(0)

coords = ee.List(coords)


//Export as CSV
var myFeatures = ee.FeatureCollection(coords.map(function(el){
el = ee.List(el) // cast every element of the list
var geom = ee.Geometry.Point([ee.Number(el.get(0)), ee.Number(el.get(1))])
return ee.Feature(null, {'VH':ee.Number(el.get(2)), 'VV':ee.Number(el.get(3)),
'Long':ee.Number(el.get(0)),'Lat':ee.Number(el.get(1))})

}))

return myFeatures
})

var table= newfc.flatten()

print(newfc);
print(table)

// Export the image, specifying scale and region.
// Export the FeatureCollection.
Export.table.toDrive({
collection: table,
description: 'TRIAL',
fileFormat: 'CSV'
});

//_____________________________________


Link to locations table: https://code.earthengine.google.com/?asset=users/rawailnaeem/test



Right now it is working fine for 1 image. I need this for each image in the imageCollection, not a mosaic image. So basically my question is how to loop this function over the entire image collection?










share|improve this question
















I have 21 polygons and for each polygon I want to extract the pixel values inside them for Sentinel 1 images from 2017-01-01 to 2017-06-30.



The example below shows how this is done for one polygon. I want this for 21 polygons.
Extract complete pixel values inside a geometry



My expected output is a csv with columns polygon name, lat, lon, VH, VV and system:time start dates.



This is what I have so far.



//Location Data
var test= loc;
print(test);
Map.centerObject( test, 10);


// SENTINEL 1 DATA
var pol = ['VV', 'VH'];
//Load Sentinel1 image location around location 1
var Sentinel1= S1.filter(ee.Filter.eq('transmitterReceiverPolarisation', pol))
.filterMetadata('instrumentMode', 'equals', 'IW')
.filterDate('2017-01-01', '2017-06-30')
.filterBounds(test)
.select(['VH', 'VV'])
.filterMetadata('resolution_meters', 'equals' , 10).first();

Map.addLayer(Sentinel1, imageVisParam, 'single_image');
print(Sentinel1)

// generate a new image containing lat/lon of the pixel and reproject it to Sentinel1 projection
var coordsImage = ee.Image.pixelLonLat().reproject(Sentinel1.projection())
var joinedImage = coordsImage.addBands(Sentinel1);
print(joinedImage)

// extract lat/lon coordinates as a list
var newfc= test.map(function(feat){
var coords = joinedImage.reduceRegion({
reducer: ee.Reducer.toList(4),
geometry: feat.geometry(),
scale: 10

}).values().get(0)

coords = ee.List(coords)


//Export as CSV
var myFeatures = ee.FeatureCollection(coords.map(function(el){
el = ee.List(el) // cast every element of the list
var geom = ee.Geometry.Point([ee.Number(el.get(0)), ee.Number(el.get(1))])
return ee.Feature(null, {'VH':ee.Number(el.get(2)), 'VV':ee.Number(el.get(3)),
'Long':ee.Number(el.get(0)),'Lat':ee.Number(el.get(1))})

}))

return myFeatures
})

var table= newfc.flatten()

print(newfc);
print(table)

// Export the image, specifying scale and region.
// Export the FeatureCollection.
Export.table.toDrive({
collection: table,
description: 'TRIAL',
fileFormat: 'CSV'
});

//_____________________________________


Link to locations table: https://code.earthengine.google.com/?asset=users/rawailnaeem/test



Right now it is working fine for 1 image. I need this for each image in the imageCollection, not a mosaic image. So basically my question is how to loop this function over the entire image collection?







remote-sensing google-earth-engine






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 5 '18 at 7:56







Rawail Naeem

















asked Aug 31 '18 at 11:22









Rawail NaeemRawail Naeem

7718




7718





bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

    – Rodrigo E. Principe
    Sep 3 '18 at 20:48











  • @RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

    – Rawail Naeem
    Sep 4 '18 at 6:07











  • @RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

    – Rawail Naeem
    Sep 5 '18 at 10:41











  • Hi, sorry, I haven't had the time to look at it

    – Rodrigo E. Principe
    Sep 5 '18 at 18:42





















  • Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

    – Rodrigo E. Principe
    Sep 3 '18 at 20:48











  • @RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

    – Rawail Naeem
    Sep 4 '18 at 6:07











  • @RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

    – Rawail Naeem
    Sep 5 '18 at 10:41











  • Hi, sorry, I haven't had the time to look at it

    – Rodrigo E. Principe
    Sep 5 '18 at 18:42



















Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

– Rodrigo E. Principe
Sep 3 '18 at 20:48





Please, explain better (in this post) what are you trying to do, what is the expected result, what works and what does not. And also add the code in the post (leave the link as well)

– Rodrigo E. Principe
Sep 3 '18 at 20:48













@RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

– Rawail Naeem
Sep 4 '18 at 6:07





@RodrigoE.Principe I have added the full description. I hope it makes sense now. Thank you

– Rawail Naeem
Sep 4 '18 at 6:07













@RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

– Rawail Naeem
Sep 5 '18 at 10:41





@RodrigoE.Principe any luck with this one? The code is working fine for a single image. I just need to include a function so it gets images from the image collection.

– Rawail Naeem
Sep 5 '18 at 10:41













Hi, sorry, I haven't had the time to look at it

– Rodrigo E. Principe
Sep 5 '18 at 18:42







Hi, sorry, I haven't had the time to look at it

– Rodrigo E. Principe
Sep 5 '18 at 18:42












1 Answer
1






active

oldest

votes


















0














The comment by @Rodrigo E. Principe is probably what you are looking for.



You basically go through each feature with the .map(myFunction) and then in myFunction you iterate through the image collection.



Extracting pixel values by points and converting to table in Google Earth Engine?






share|improve this answer


























  • Can't get it right. Can yo please show how it can be implemented on this code?

    – Rawail Naeem
    Sep 17 '18 at 11:03












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f294595%2fextract-pixel-values-for-multiple-polygons-and-images%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









0














The comment by @Rodrigo E. Principe is probably what you are looking for.



You basically go through each feature with the .map(myFunction) and then in myFunction you iterate through the image collection.



Extracting pixel values by points and converting to table in Google Earth Engine?






share|improve this answer


























  • Can't get it right. Can yo please show how it can be implemented on this code?

    – Rawail Naeem
    Sep 17 '18 at 11:03
















0














The comment by @Rodrigo E. Principe is probably what you are looking for.



You basically go through each feature with the .map(myFunction) and then in myFunction you iterate through the image collection.



Extracting pixel values by points and converting to table in Google Earth Engine?






share|improve this answer


























  • Can't get it right. Can yo please show how it can be implemented on this code?

    – Rawail Naeem
    Sep 17 '18 at 11:03














0












0








0







The comment by @Rodrigo E. Principe is probably what you are looking for.



You basically go through each feature with the .map(myFunction) and then in myFunction you iterate through the image collection.



Extracting pixel values by points and converting to table in Google Earth Engine?






share|improve this answer















The comment by @Rodrigo E. Principe is probably what you are looking for.



You basically go through each feature with the .map(myFunction) and then in myFunction you iterate through the image collection.



Extracting pixel values by points and converting to table in Google Earth Engine?







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 6 '18 at 14:20









Vince

14.8k32850




14.8k32850










answered Sep 6 '18 at 12:22









Sean RouletSean Roulet

33719




33719













  • Can't get it right. Can yo please show how it can be implemented on this code?

    – Rawail Naeem
    Sep 17 '18 at 11:03



















  • Can't get it right. Can yo please show how it can be implemented on this code?

    – Rawail Naeem
    Sep 17 '18 at 11:03

















Can't get it right. Can yo please show how it can be implemented on this code?

– Rawail Naeem
Sep 17 '18 at 11:03





Can't get it right. Can yo please show how it can be implemented on this code?

– Rawail Naeem
Sep 17 '18 at 11:03


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f294595%2fextract-pixel-values-for-multiple-polygons-and-images%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Щит и меч (фильм) Содержание Названия серий | Сюжет |...

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

Meter-Bus Содержание Параметры шины | Стандартизация |...