AnsweredAssumed Answered

Trying to save multiple file types to same location while using the same file name.

Question asked by phydoux86 on Aug 14, 2015
Latest reply on Sep 1, 2015 by dkwiens

Hey,

I'm trying to build a tool using model builder that I can use to input an Excel spreadsheet and create a shapefile and a KML that saves in the same folder and has the same file name. I want the KML file to automatically default to whatever my output is for the shapefile but i think I am going to have to use python to figure out this last part. I'm really new to this and just now learning writing script.

 

 

Can someone help me with the last portion of this script? I would really appreciate it.

 

# -*- coding: utf-8 -*-

# ---------------------------------------------------------------------------

# ExcelToShpPlusKML.py

# Created on: 2015-08-13 20:50:17.00000

#   (generated by ArcGIS/ModelBuilder)

# Usage: ExcelToShpPlusKML <Input_Address_Locator> <Input_Table> <Output_Feature_Class>

# Description:

# ---------------------------------------------------------------------------

 

# Import arcpy module

import arcpy

 

# Script arguments

Input_Address_Locator = arcpy.GetParameterAsText(0)

 

Input_Table = arcpy.GetParameterAsText(1)

 

Output_Feature_Class = arcpy.GetParameterAsText(2)

 

# Local variables:

Output_Table__2_ = Output_Feature_Class

Output_Table = Output_Table__2_

Output_Layer = Output_Table

Output_File = Output_Layer

 

# Process: Geocode Addresses

arcpy.GeocodeAddresses_geocoding(Input_Table, Input_Address_Locator, "", Output_Feature_Class, "STATIC")

 

# Process: Delete Field

arcpy.DeleteField_management(Output_Feature_Class, "")

 

# Process: Delete Rows

arcpy.DeleteRows_management(Output_Table__2_)

 

# Process: Make Feature Layer

arcpy.MakeFeatureLayer_management(Output_Feature_Class, Output_Layer, "", "", "")

 

# Process: Layer To KML

arcpy.LayerToKML_conversion(Output_Layer, Output_File, "0", "false", "DEFAULT", "1024", "96", "CLAMPED_TO_GROUND")

Outcomes