Skip to main content
Improved title
Link
Hornbydd
  • 44.6k
  • 5
  • 42
  • 84

Extract Raster Values Unpack error occuring when sampling raster values to Sampling Points in Pythonpoints with rasterio

deleted 74 characters in body
Source Link

I'm new to Python. I wasI'm trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error .

enterimport codefiona
import hererasterio as rio
import pandas as pd

 multi_values_points = pd.Series()
 with fiona.open(inputShape) as shp:
     for feature in shp:
        Name = feature['properties']['Name']
        coords = feature['geometry']['coordinates']
        with rio.open(inputRaster) as stack_src:
           value = [v for v in stack_src.sample([coords])]
        multi_values_points.loc[Name] = value
 
 **ValueError: not enough values to unpack (expected 2, got 1)**

with fiona.open(inputShape) as shp: for feature in shp: Name = feature['properties']['Name'] print(Name) coords = feature['geometry']['coordinates'] print(coords) with raster.open(inputRaster) as stack_src: value = [v for v in stack_src.sample([coords])] # Update the pandas serie accordingly multi_values_points.loc[Name] = value

ValueError: not enough values to unpack (expected 2, got 1)enter code here

I'm new to Python. I was trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error .

enter code here
multi_values_points = pd.Series()

with fiona.open(inputShape) as shp: for feature in shp: Name = feature['properties']['Name'] print(Name) coords = feature['geometry']['coordinates'] print(coords) with raster.open(inputRaster) as stack_src: value = [v for v in stack_src.sample([coords])] # Update the pandas serie accordingly multi_values_points.loc[Name] = value

ValueError: not enough values to unpack (expected 2, got 1)enter code here

I'm new to Python. I'm trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error .

import fiona
import rasterio as rio
import pandas as pd

 multi_values_points = pd.Series()
 with fiona.open(inputShape) as shp:
     for feature in shp:
        Name = feature['properties']['Name']
        coords = feature['geometry']['coordinates']
        with rio.open(inputRaster) as stack_src:
           value = [v for v in stack_src.sample([coords])]
        multi_values_points.loc[Name] = value
 
 **ValueError: not enough values to unpack (expected 2, got 1)**
Source Link

Extract Raster Values to Sampling Points in Python

I'm new to Python. I was trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error .

enter code here
multi_values_points = pd.Series()

with fiona.open(inputShape) as shp: for feature in shp: Name = feature['properties']['Name'] print(Name) coords = feature['geometry']['coordinates'] print(coords) with raster.open(inputRaster) as stack_src: value = [v for v in stack_src.sample([coords])] # Update the pandas serie accordingly multi_values_points.loc[Name] = value

ValueError: not enough values to unpack (expected 2, got 1)enter code here