Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

select by attrib then copy

$
0
0
dear experts,

i want to select some objects from SDE FC inside a FD then copy them into FileGDB (SELECT BY ATTRIBUTE first, then the result of the select is made as input to subsequent process, which is the COPY).
I built a model and then import the script:

# ---------------------------------------------------------------------------
# pyton.py
# Created on: Wed Feb 12 2014 05:31:43 PM
# (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")


# Local variables...

#results to keep the selection
LU_jpna_DJ = "D:\\_hadniu_\\DefaultGDB.gdb\\LU_jpna_DJ"
jpna_opt_SDE_landuse_DJ = "jpna_opt.SDE.landuse_DJ"

#SDE FC in a dataset
jpna_opt_SDE_landuse_DJ__2_ = "jpna_opt.SDE.landuse_DJ"

# Process: Select Layer By Attribute...
gp.SelectLayerByAttribute_management(jpna_opt_SDE_landuse_DJ__2_, "NEW_SELECTION", "OBJECTID < 70")

# Process: Copy Features...
gp.CopyFeatures_management(jpna_opt_SDE_landuse_DJ, LU_jpna_DJ, "", "0", "0", "0")


When i run the script, it gave me error something about parameter in SelectLayerByAttribute_management is not correct.

What could be wrong ? Why the generated script is not correct (one sample is that it cant define the location of the SDE connection) ? What workspace should i set, workspace in file geodb or SDE geodb ?

Please help

thanks

Viewing all articles
Browse latest Browse all 2485

Trending Articles