I am trying to write a script to use in the Sverchok addon, that utilizes a file path input, but I am having trouble making this work.
Here is my script:
"""
in path FP
out Attibute s
"""
import geopandas as gpd
import pandas as pd
import fiona
import numpy as np
path2 = path
gpd1 = gpd.read_file(path2, layer = "test shapes - polygons 1")
# call geo interface method on geodataframe
gi = gpd1.__geo_interface__
# variable to control which attribute is being extracted
variableAttribute = 'Integer'
# create empty list to add attributes to
listAttribute = []
# loop through geointerface (gi) and extract values from the 'Integer' column, and add them to the list created above
for features in range(len(gi['features'])):
value = [gi['features'][features]['properties'][variableAttribute]]
listAttribute.append(value)
Attribute = listAttribute
Here is a screenshot of my node setup:
For some reason, the filepath input works in a basic script (see the 'test_filepath1.py' in the screenshot). But, when trying to implement this in a more complex script, I cannot make this work.
Here is a zip file with sample data, blend file, and scripts: https://drive.google.com/file/d/1GZMr7hYXxMN8YJNQ2lIls4B7O_ANEI1F/view?usp=sharing
Any ideas or info on why this isn't working? Thanks,