I can't save featuresets to shapefiles, convert between shapely arcgis polygon, calculate area, get enrichment data...
def save_polygon_to_shapefile(
self, polygon: Polygon, polygon_type: str, filename: str
) -> tuple[pathlib.Path, str]:
"""Saves a arcgis.geometry.polygon to a shapefile as a Feature Set.
Args:
polygon (Polygon): an arcgis.geometry.polygon object
polygon_type (str): a string representing the type of polygon as defined in the config file
filename (str): a string representing the name of the file to save.
Returns:
tuple[pathlib.Path, str]: a tuple containing a patlib.path to the file directory and the filename
"""
file_dir, filename = self.generate_polygon_file_path(
polygon_type=polygon_type, filename=filename
)
f = Feature(geometry=polygon, attributes={})
fset = FeatureSet([f])
try:
"""
Note:
Arcgis featureset.save splits by . from the right and takes the first part as the file name,
so we must make sure to add a decimal after the filename if the unit in the polygon type has a decimal point
but the actual extension (shp) added here doesnt actually matter its just for readability.
"""
fset.save(save_location=file_dir, out_name=f"{filename}.shp")
except Exception as e:
self.logger.warning(e, exc_info=True)
return None, None
return file_dir, filenameI keep getting this error:
The Product License has not been initialized.
How do I save a feature set to a shapefile without depending on Arcgis Pro?