Select to view content in your preferred language

Working with Union

958
6
03-26-2012 10:09 AM
SebastianSieh
Emerging Contributor
Hey everyone

i just started coding with pythonwin for ArcGis 10

and i got a question - iam trying to union 2 maps... if i try it in arcgis by hand its working fine but with python i get an error

import arcpy from arcpy import env  #Folder env.workspace="P:/workspace"  # file kreisumring and gemeinden at workspace folder  inCover="Kreisumring" unionCover="Gemeinden" outCover="P:/workspace/vereinigt" joinAttributes = "JOIN" arcpy.Union_arc(inCover, unionCover, outCover, "", joinAttributes)

Errors:
ERROR 000732: Input Coverage: Dataset kreisumring does not exist or is not supported ERROR 000732: Union Coverage: Dataset gemeinden does not exist or is not supported Failed to execute (Union).


existing files (for gemeinden aswell):
kreisumring.dbf
kreisumring.prj
kreisumring.sbn
kreisumring.sbx
kreisumring.shp

i searched alot... but didnt found something usefull -  ofc i searched at desktop help 10. (as you can see 😛 )

thank you for any kind of help !
Tags (2)
0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor
Try specifying '.shp' for your input layers.  Ex:

inCover="kreisumring.shp"
unionCover="gemeinden.shp"
0 Kudos
MathewCoyle
Honored Contributor
You need to specify they are shapefiles.

inCover="kreisumring.shp"
unionCover="gemeinden.shp"

Edit: Ah Jake beats me to it.
0 Kudos
SebastianSieh
Emerging Contributor
Thanks for this fast replies !

Changed it and still "same" Errors
ERROR 000732: Input Coverage: Dataset Kreisumring.shp does not exist or is not supported
ERROR 000732: Union Coverage: Dataset Gemeinden.shp does not exist or is not supported
Failed to execute (Union).
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Looks like you are using the Union_arc tool, which is for coverages.  Try the Union_analysis tool, which is for feature classes/shapefiles.
0 Kudos
MathewCoyle
Honored Contributor
Are those shapefiles in your workspace directory? Try setting the full path for these variables. And add a .shp to your output as well.

inCover="P:/workspace/Kreisumring.shp"
unionCover="P:/workspace/Gemeinden.shp"
outCover="P:/workspace/vereinigt.shp"


Edit: Jake again!
0 Kudos
SebastianSieh
Emerging Contributor
Looks like you are using the Union_arc tool, which is for coverages.  Try the Union_analysis tool, which is for feature classes/shapefiles.


Are those shapefiles in your workspace directory? Try setting the full path for these variables. And add a .shp to your output as well.

inCover="P:/workspace/Kreisumring.shp"
unionCover="P:/workspace/Gemeinden.shp"
outCover="P:/workspace/vereinigt.shp"


Edit: Jake again!


Thanks alot Guys !

finaly 😄
# Import the system modules
import arcpy
from arcpy import env
 
# Set the current workspace 
env.workspace = "P:/workspace"
 

# Union 3 feature classes carry all
inFeatures = ["Kreisumring.shp", "Gemeinden.shp", "Einzelgemeinden.shp"]
outFeatures = "alle"
clusterTol = 0.0000
arcpy.Union_analysis (inFeatures, outFeatures, "ALL", clusterTol)


Well iam not sure about clusterTol but i gonna read the Desktop Help article again !

Thanks again

#Problem solved
0 Kudos