2 weeks ago - last edited 2 weeks ago
I have a spatial model which extracts the vegetation class from the NIR imagery.
I aim to run this every five years to detect the changes in our shire.
This years imagery was easy. I just used an Input of >= 0.155 and that seemed good enough.
I am having trouble with the 2012 NIR imagery, which has a lot more greener (redder) grass, so I am having trouble getting the right balance so that grass and shadows are excluded and as many trees are included. I have used a range, currently set to >= 0.45 and <= 0.6, but it will either remove too much tree coverage and/or keep too many shadows/grassed areas.
Is there a solution to this? I've attached the spatial model.
2 weeks ago
You can experiment with the Machine Learning operators to classify the raster. One of the possible examples is here https://community.hexagongeospatial.com/t5/ERDAS-IMAGINE/Machine-Learning-Raster-Classification/ta-p...
I am looking at this now.
I have created a shp file with points to pick up grass and trees, and have output an xls file with the X and Y's of these points.
I am writing a Python script to extract these coordinates and pass to the Get Pixel Value function.
An Int Input will pass a row value to the Python script, which I will run via a Spatial Model in a batch going through each row of the xls file.
How can I pass the X and Y from the Python script to the X and Y for the Get Pixel Value function?
Here is my script, which doesn't produce any errors until I get to the Get Pixel value function. I clearly haven't figured out how to pass Python variables to other Spatial Model functions.
import os import csv import collections def iteratecsv(input): #with open("//gissrv/lidar/Erdas Tree Canopy Work/Tree_Sample_Coords.csv", "rt") as File: with open("L:\Erdas Tree Canopy Work\Tree_Sample_Coords.csv", "rt") as File: reader = csv.reader(File, delimiter=',', quotechar=',', quoting=csv.QUOTE_MINIMAL) #num_lines = sum(1 for line in open('//gissrv/lidar/Erdas Tree Canopy Work/Tree_Sample_Coords.csv')) #for c, row in enumerate(reader): #print(c,row[0:2]) #https://www.alexkras.com/how-to-read-csv-file-in-python/ next(reader) #skip header data = [r for r in reader] #print(data[input]) #X value #print(data[input]) #Y value X = data[input] Y = data[input]
As an alternative you could try the new Add Attributes by Location operator.