I had a problem solved here.
I had 2 features: polygons and points, both containing similar attributes(example: street name, number). Each polygon must have equivalent point added(same street name, same number), and I had to detect which polygons didn't have a point feature(or if they had one and the values are different, because of typos and such). The problem was solved by doing a spacial join and then filtering the ones with different values.
My new problem is that I need to run the script on an selection of features. Here
you can find something that i plan to use. As I see it , before I run
arcpy.MakeFeatureLayer_management I should use the
arcpy.CopyFeatures_management feature, with
arcpy.env.workspace = "in_memory" defined.
But what should I grab for the "selected_features" ? In that code, that does "pipes" define? Were does "in_memory" kick in?
import arcpy arcpy.env.overwriteOutput = True from arcpy import env arcpy.env.workspace = "in_memory" # *make 'in memory' selection from featurelayer arcpy.CopyFeatures_management (in_feat, out_feat) selected_features = "D:/ALTE PROIECTE/script/cladiri adrese/Adrese_Output.shp" sel_adrese = "D:/ALTE PROIECTE/script/cladiri adrese/selectadrese.shp" arcpy.CopyFeatures_management ("D:/ALTE PROIECTE/script/cladiriadrese/Adrese_Output.shp", sel_adrese) selected_features = "D:/ALTE PROIECTE/script/cladiri adrese/cladiri_Output.shp" sel_poligon = "D:/ALTE PROIECTE/script/cladiri adrese/selectpoligon.shp" arcpy.CopyFeatures_management ("D:/ALTEPROIECTE/script/cladiriadrese/cladiri_Output.shp", sel_poligon) # *Make Feature Layers from memory selection arcpy.MakeFeatureLayer_management(sel_adrese, "lyr_Adresa") arcpy.MakeFeatureLayer_management(sel_poligon, "lyr_Poligon") # *Do a spatial join inputFC = "lyr_Poligon" joinFC = "lyr_Adresa" outputFC = "D:/ALTE PROIECTE/script/cladiri adrese/JoinPoligonAdresa.shp" arcpy.SpatialJoin_analysis(inputFC, joinFC, outputFC) # *Make a new Feature Layer that just contains the ones that need fixed arcpy.MakeFeatureLayer_management("D:/ALTE PROIECTE/script/cladiriadrese/JoinPoligonAdresa.shp", "lyr_MySpatialJoinLayer", "(\"Strada\" <> \"DenumireAr\") >OR (\"Nr_postal\" <> \"Nr_Posta_1\")") # *Create a new shapefile (or FGDB) with just the polygons that need fixed arcpy.CopyFeatures_management("lyr_MySpatialJoinLayer", "D:/ALTE PROIECTE/script/cladiriadrese/Erori.shp")
That code will do the spacialjoin, but not on the features I selected. what I am missing out? I am using arcgis 10.2