How can I reshape a satellite image in Earth Engine? - google-earth-engine

I have satellite image with 3 bands as B2,B3,B4, I want to convert each band to one column. for example B2 band places in first column, B3 band places in second column...

Related

Perform join using latitude and longitude in R

I have an excel spreadsheet with the latitude and longitude of bike docking stations.
I have a shape file in R (cb_2018_17_bg_500k.shp) that has GEOID (12 digit FIPS code) column and a column labelled geometry. The values in this column are POLYGON((longitude,latitude))
I am trying to add a column in the excel spreadsheet titled FIPS. So, I need to somehow join the latitude and longitude to GEOID column in the shape file.
I am a novice when it comes to R.
Any advice will be much appreciated.
Rich
So far, I have only managed to upload the shape file to R.

extracting pixel values above a value per polygon in R

I have a shapefile containing 38 polygons i.e. 38 states of a country. This shapefile is overlaid on a raster. I need to extract/reclassify pixel above a certain value, specific to each polygon.
For example, I need to extract the raster pixels> 120 for state/polygon 1, pixels> 189 for polygon 2 etc with the resulting raster being the extracted pixels with value 1 and everything else as NoData. Hence, it seems like I need to extract first and then reclassify.
I have the valuees, for extraction, saved as a data frame with a column containing names, matching the names of the states,which is stored as an attribute "Name" in the shapefile.
Any suggestion on how I could go about this?
Should I extract the raster for each state into 38 separate rasters, then do reclassify () and then mosaic to make one raster i.e. the country?

Given a vector of coordinates, identify the polygon from a shapefile it falls into

I have my polygons stored in a SpatialPolygonsDataFrame and my coordinates in a data frame.
The output I want is to just have an additional column on my data frame that tags the OBJECTID (id of the polygon from the shapefile) that the coordinates fall into.
My problem is kind of the same with this
But its output is a little bit different. Also, it's kinda slow. I tried to tag just 4 coordinates and it took more than 5 minutes. I'm gonna be tagging 16k coordinates so would it be possible to do it faster?
The current methods I know about wouldn't do that exactly (i.e., produce one polygon id per coordinate) because they're generalized in case one point is contained in multiple (overlapping polygons).
See sp::over(), which used to be called overlay().
Example:
over(sr, geometry(meuse), returnList = TRUE)
over(sr, meuse, returnList = TRUE)
Possible duplicates (it's hard to tell without seeing your example data):
Extracting points with polygon in R
Intersecting Points and Polygons in R

Extracting points that belong to a certain area of a RasterLayer (raster)

As per title.
I have a "classified" RasterLayer object which has (apart from NAs) two fixed values, 0 and 1. It is a kind of logical image.
I also have a data frame of points with their coordinates, in form of a SpatialPointsDataFrame.
How can I extract points belonging to a certain area (0 or 1)? Been searching into raster-package help but I couldn't find a solution.
You can use extract from the raster package:
"Extract values from a Raster* object at the locations of other
spatial data (that is, perform a spatial query). You can use
coordinates (points), lines, polygons or an Extent (rectangle) object.
You can also use cell numbers to extract values."
values <- extract(x="YourRasterLayer", y="YourSpatialPointsDataFrame")
For more information type:
?raster::extract
or visit this page.

Create event frequency graph from a datetime column in google spreadsheet

I have a google spreadsheet containing a column of datetime values. There can be as many as 10 values that occur on a common date (at different times). Is it possible to create a graph that shows frequency of "events per day" such that the x axis is a date and the y axis is a numerical value from 0 to 10? There doesn't appear to be anything in the chart wizard that resembles this idea and my knowledge of spreadsheets is just about nil...
It is possible but I can't say I'm impressed by the results. If your column of datetime values starts in A2, please insert in B2 =int(A2) and in C2:
=if(B1=B2,1+C1,1)
and copy both down to suit. You might want to add an earlier date in B1.

Resources