AnsweredAssumed Answered

How intersect  layers and exporting to shapefile with ArcPy

Question asked by Victor40 on Jun 16, 2017
Latest reply on Jun 16, 2017 by Victor40

Hi every one I need some help!!

 

I want to intersect a few shapefile multipoint with other shapefile polygon, and the selection points intersected I need to export to shapefile with diferent name, but I get a nasty error.

 

Somebody can help me to fix the problem?

 

This my script:

 

import arcpy
from arcpy import env

arcpy.env.overwriteOutput = True

Ruta1_entrada = r'D:\\SedesolVQB\\'
Shp1 = 'n_loctdico_0417_09_.shp' #<---Shp multipoint
Shp1_entrada = Ruta1_entrada + Shp1

Ruta2_entrada = r'D:\\SedesolVQB\\'
Shp2 = 'Areas_intersectan.shp' #<----Shp Polygon
Shp2_entrada = Ruta2_entrada + Shp2

Ruta3_salida = r'D:\\SedesolVQB\\Resultado_final\\'
Shp_final = 'Resultado_fina.shp'
Resultado_final = Ruta3_salida +Shp_final

#Convert to layer
arcpy.MakeFeatureLayer_management(Shp1_entrada,"Tiendas.lyr")
#Select by location
arcpy.SelectLayerByLocation_management("Tiendas.lyr","INTERSECT",Shp2_entrada, "","NEW_SELECTION")
Num_seleccionados = arcpy.GetCount_management(Shp1)

print "Puntos seleccionados: " + str(Num_seleccionados)

 

 

However, I get the next error message:

Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "D:\SedesolVQB\Proyectos\proyecto_MODELBUILDER_DGAAE\Selectbylocation.py", line 14, in <module>
arcpy.env.overwriteOutput = True
AttributeError: 'str' object has no attribute 'overwriteOutput

Outcomes