I have created a model to create a projected feature class from a KML/KMZ. The reason for this is that once I get the model to work, I will be adding a script at the end to create attributes from the PopupInfo field that is created from the KML to Layer tool. I'm using ArcGIS Pro 2.9.5 (10.9). Before you say I should upgrade, my organization isn't upgrading yet.
For the KML to Layer tool, I've set the Input KML and Output Location as model parameters. For the Output Data Name, I used the calculate value tool to get the KML name from the Input Kml stripping the path and extension. Output is "Value". I set the KML to Layer Output Data Name as %Value%. The tool automatically creates a geodatabase with the name of %Value%.gdb and places the Point/Polyline and Polygon feature classes in that database. I use the Select Data tool to get the Points feature class from the geodatabase to use as input for the Project tool. This is where the model is going awry. For the Output Feature Class, I would like to put it into the same geodatabase that was created from the Kml to layer tool. Everything I try doesn't recognize the geodatabase and adds the .shp extension to create a shapefile. Things I've tried: Output Dataset =
- %Value%.gdb\%Value%_Points
- %Output_Location%\%Value%.gdb\%Value%_Points
- %Geodatabase%\%Value%_Points - Add another Calculate Value tool with expression '%Output_Location%'+'\'+'%Value%'+'.gdb' and using the output (Geodatabase)
- %Workspace\%Value%_Points - Scripting the workspace as the path of the geodatabase with the Output_Location and Value as script parameters and using Workspace
- %Path%\%Name%.%Extension%\%Name% - Parse Path tool on the geodatabase output of the kml to layer tool
- %Path%\%Value% - Parse Path on the Points FC from the Select data tool
- %Selected_GDB%\%Value% to use database from Select Data tool
- %NewGeodatabase%\%Value%I've set the Kml to layer output as static InputKML and added a create File Geodatabase tool. File Geodatabase Location is %Output_Location% and GDB name is %Value%.gdb. Renamed Output to NewGeodatabase, set as current workspace for tool
- I tried doing the Feature to Feature tool instead and adding an output coordinate system, but that didnt' work either. I think the error was invalid parameter
Everything in the model works fine up to the Project Tool. It insists on creating a shapefile from anything I put in the Output.
- I've used the %Output_Location%\CurrentGeodatabase.gdb\%Value%_Points and that worked fine since the geodatabase was already set and the path found. So it is the geodatabase path that is the problem.
I don't know what else to try. Some things I've come across: In Calculate Value, I'm not able to add more than one line to the expression, and os is not recognized without import os The Project tool initially puts the path to the default geodatabase for my project and that works fine. the Output Location parameter is set as type: folder so the Set Workspace script has it set as folder as well. The KML to layer tool won't work unless there are default values for the Output Location and Input KML parameters. I've made sure those don't have spaces, leading numbers, etc., if that matters.