Michipoo

Setting Workspace

Discussion created by Michipoo on Aug 2, 2011
Latest reply on Aug 2, 2011 by Michipoo
Hello,

I'm a python and arcpy beginner. I have a few simple scripts I'm working on for practice, but I'm having trouble with this one.

Purpose = Create a 200 ft buffer around a user selected feature.

Issue = I would like the 'output feature class' to default to a certain file path. I attempted to do this using arcpy.env.workspace. However, the default path keeps pointing to my C:\....Documents\ArcGIS\Default.gdb

I've looked at some other examples and cannot figure out what I am doing wrong. I'd appreciate any help. Thanks.

import arcpy
from arcpy import env
import os

#----------------------------------
# Set the geoprocessing environment
#----------------------------------

env.workspace = r"J:\Work\Projects\Case Change Maps\Python\Temp"
env.overwriteOutput = True

#----------------------------------
# Get Parameters from the user
#----------------------------------

DataToBuffer = arcpy.GetParameterAsText(0)
if DataToBuffer == '#' or not DataToBuffer:
    DataToBuffer = "BASE.BASEMAP" # provide a default value if unspecified

BufferName = arcpy.GetParameterAsText(1)
if BufferName == '#' or not BufferName:
    BufferName = "BUFF.shp" # provide a default value if unspecified

#----------------------------------
# Process
#----------------------------------

# Buffer the basemap selection
arcpy.Buffer_analysis(DataToBuffer, BufferName, "200 Feet", "FULL", "ROUND", "NONE", "")

Attachments

Outcomes