Skip to main content
edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Recently while working with GEE in python I was trying to slice a Landsat image to get its bands and grid for a specific area. On

On the first stage I sampled a neighborhood around a point with radius 150 pixels (i.e. 4500 m):

neighborhood = image.neighborhoodToArray(kernel=ee.Kernel.square(radius=150, units='pixels'))
data = neighborhood.sampleRectangle(point)
result_dict = data.getInfo()

After doing so I managed to obtain an array containing values for each band I selected:

array = np.empty((10,301,301))
for i, key in enumerate(bands):
  region = result_dict['properties'][key]
  array[i] = region[0][0][:][:]

So my question is how to get a geographical grid for this data? 

In other words, is it possible to access latitudes and longitudes as a raster layer and extract it?

I know how to do that using rasterio and gdal, but it requires direct download of the data, which I'd like to avoid.

So I'd highly appreciate any help or advice! Thanks:))

Recently while working with GEE in python I was trying to slice a Landsat image to get its bands and grid for a specific area. On the first stage I sampled a neighborhood around a point with radius 150 pixels (i.e. 4500 m):

neighborhood = image.neighborhoodToArray(kernel=ee.Kernel.square(radius=150, units='pixels'))
data = neighborhood.sampleRectangle(point)
result_dict = data.getInfo()

After doing so I managed to obtain an array containing values for each band I selected:

array = np.empty((10,301,301))
for i, key in enumerate(bands):
  region = result_dict['properties'][key]
  array[i] = region[0][0][:][:]

So my question is how to get a geographical grid for this data? In other words, is it possible to access latitudes and longitudes as a raster layer and extract it?

I know how to do that using rasterio and gdal, but it requires direct download of the data, which I'd like to avoid.

So I'd highly appreciate any help or advice! Thanks:))

Recently while working with GEE in python I was trying to slice a Landsat image to get its bands and grid for a specific area.

On the first stage I sampled a neighborhood around a point with radius 150 pixels (i.e. 4500 m):

neighborhood = image.neighborhoodToArray(kernel=ee.Kernel.square(radius=150, units='pixels'))
data = neighborhood.sampleRectangle(point)
result_dict = data.getInfo()

After doing so I managed to obtain an array containing values for each band I selected:

array = np.empty((10,301,301))
for i, key in enumerate(bands):
  region = result_dict['properties'][key]
  array[i] = region[0][0][:][:]

So my question is how to get a geographical grid for this data? 

In other words, is it possible to access latitudes and longitudes as a raster layer and extract it?

I know how to do that using rasterio and gdal, but it requires direct download of the data, which I'd like to avoid.

Source Link

How to extract a grid layer from GEE image?

Recently while working with GEE in python I was trying to slice a Landsat image to get its bands and grid for a specific area. On the first stage I sampled a neighborhood around a point with radius 150 pixels (i.e. 4500 m):

neighborhood = image.neighborhoodToArray(kernel=ee.Kernel.square(radius=150, units='pixels'))
data = neighborhood.sampleRectangle(point)
result_dict = data.getInfo()

After doing so I managed to obtain an array containing values for each band I selected:

array = np.empty((10,301,301))
for i, key in enumerate(bands):
  region = result_dict['properties'][key]
  array[i] = region[0][0][:][:]

So my question is how to get a geographical grid for this data? In other words, is it possible to access latitudes and longitudes as a raster layer and extract it?

I know how to do that using rasterio and gdal, but it requires direct download of the data, which I'd like to avoid.

So I'd highly appreciate any help or advice! Thanks:))