<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="comment token">#Set File workspace</SPAN>
file_workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">'N:\\GIS\\Projects\\AA_Leith_Hawkins_TestBed\\Search_Cursor\\Search_Cursor.gdb'</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> file_workspace
<SPAN class="comment token">#buffer set up</SPAN>
Holdings <SPAN class="operator token">=</SPAN> <SPAN class="string token">'N:\\GIS\\Projects\\AA_Leith_Hawkins_TestBed\\Search_Cursor\\Search_Cursor.gdb\\Data\\Holdings'</SPAN>
distances <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="number token">1000</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">4000</SPAN><SPAN class="punctuation token">]</SPAN>
unit <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Meters"</SPAN>
<SPAN class="comment token">#Make a feature layer</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>Holdings<SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Holdings_Layer'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#searchcursor for evey row in dataset</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>Holdings<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Holding_Reference_Number'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="keyword token">as</SPAN> Holdings_Ref_cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> Holdings_Ref_cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
query <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Holding_Reference_Number = "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> query
File_output <SPAN class="operator token">=</SPAN> file_workspace<SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="string token">'Buffer_'</SPAN><SPAN class="operator token">+</SPAN>str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#print File_output</SPAN>
<SPAN class="comment token">#Select Feature using the reference number from holdings layer</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByAttribute_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Holdings_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'NEW_SELECTION'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"Holding_Reference_Number = "</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Export holding to geodatabase</SPAN>
Holding_Boundary <SPAN class="operator token">=</SPAN> file_workspace<SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="string token">'Holding_'</SPAN><SPAN class="operator token">+</SPAN>str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>management<SPAN class="punctuation token">.</SPAN>CopyFeatures<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Holdings_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> Holding_Boundary<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Mutliple ring Buffer using Selected Features</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MultipleRingBuffer_analysis<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Holdings_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> File_output<SPAN class="punctuation token">,</SPAN> distances<SPAN class="punctuation token">,</SPAN> unit<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ALL"</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>File_output<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Buffer_Layer'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#arcpy.Buffer_analysis("Holdings_Layer", ofc, var_Buffer, "FULL", "ROUND", "ALL", "")</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'Buffer complete'</SPAN>
<SPAN class="comment token">#Intersect Features</SPAN>
Intersect_out_features <SPAN class="operator token">=</SPAN> file_workspace<SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="string token">'Intersect_'</SPAN><SPAN class="operator token">+</SPAN>str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Intersect_analysis<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>Holdings<SPAN class="punctuation token">,</SPAN>File_output<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>Intersect_out_features<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"INPUT"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"intersect Complete"</SPAN>
<SPAN class="comment token">#delete Fields</SPAN>
Drop_Fields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'FID_Holdings'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Holding_Reference_Number'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Holding_Location_Address'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Local_Land_Services_Region_Id'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'Local_Land_Services_Region_Name'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'RLPB_Board_Name'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Property_Identification_Code'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Occupier_Id'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'Occupier_Full_Name'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Occupier_Mailing_Address'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Occupier_Home_Phone'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Occupier_Mobile_Phone'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'Occupier_Email_Address'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Total_Area'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Is_Rateable_Indicator'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Rateable_Area'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Nominal_Notional_Carrying_Cap'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'FID_Buffer_108050022'</SPAN><SPAN class="punctuation token">]</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DeleteField_management<SPAN class="punctuation token">(</SPAN>Intersect_out_features<SPAN class="punctuation token">,</SPAN>Drop_Fields<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Export to Excel</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>Intersect_out_features<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Intersect_Layer'</SPAN><SPAN class="punctuation token">)</SPAN>
Intersect_Selection_Excel <SPAN class="operator token">=</SPAN> <SPAN class="string token">'distance = 1000'</SPAN>
<SPAN class="keyword token">print</SPAN> Intersect_Selection_Excel
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByAttribute_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Intersect_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'NEW_SELECTION'</SPAN><SPAN class="punctuation token">,</SPAN> Intersect_Selection_Excel<SPAN class="punctuation token">)</SPAN>
Excel_Output <SPAN class="operator token">=</SPAN> <SPAN class="string token">'N:\\GIS\\Projects\\AA_Leith_Hawkins_TestBed\\Search_Cursor\\'</SPAN>
Excel_Location <SPAN class="operator token">=</SPAN> Excel_Output <SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN>str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN><SPAN class="string token">'.xls'</SPAN>
<SPAN class="keyword token">print</SPAN> Excel_Location
arcpy<SPAN class="punctuation token">.</SPAN>TableToExcel_conversion<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Intersect_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> Excel_Location<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#arcpy.SelectLayerByAttribute_management('Intersect_Layer', 'CLEAR_SELECTION')</SPAN>
<SPAN class="comment token">#print Png_output</SPAN>
<SPAN class="comment token">#test = arcpy.MakeFeatureLayer_management(File_output, 'Buffer_Layer')</SPAN>
<SPAN class="comment token">#arcpy.ApplySymbologyFromLayer_management('Buffer_Layer', 'C:\\Database_connections\\assesment_Model_lyr\\Buffer.lyr')</SPAN>
<SPAN class="comment token">#arcpy.ApplySymbologyFromLayer_management('Holdings_Layer',</SPAN>
<SPAN class="comment token"># 'C:\\Database_connections\\assesment_Model_lyr\\Holding.lyr')</SPAN>
<SPAN class="comment token">#arcpy.ApplySymbologyFromLayer_management('Intersect_Layer',</SPAN>
<SPAN class="comment token"># 'C:\\Database_connections\\assesment_Model_lyr\\Intersect.lyr')</SPAN>
<SPAN class="comment token">#add Layers to the Map</SPAN>
mxd <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>MapDocument<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'N:\\GIS\Projects\\AA_Leith_Hawkins_TestBed\\Search_Cursor\\Search_Cursor_mxd.mxd'</SPAN><SPAN class="punctuation token">)</SPAN>
df <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListDataFrames<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Layers"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
addLayer <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>Layer<SPAN class="punctuation token">(</SPAN>File_output<SPAN class="punctuation token">)</SPAN>
addLayer2 <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>Layer<SPAN class="punctuation token">(</SPAN>Holding_Boundary<SPAN class="punctuation token">)</SPAN>
addLayer3 <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>Layer<SPAN class="punctuation token">(</SPAN>Intersect_out_features<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>AddLayer<SPAN class="punctuation token">(</SPAN>df<SPAN class="punctuation token">,</SPAN> addLayer<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"TOP"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> addLayer
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>AddLayer<SPAN class="punctuation token">(</SPAN>df<SPAN class="punctuation token">,</SPAN> addLayer2<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"TOP"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> addLayer2
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>AddLayer<SPAN class="punctuation token">(</SPAN>df<SPAN class="punctuation token">,</SPAN> addLayer3<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"TOP"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> addLayer3
arcpy<SPAN class="punctuation token">.</SPAN>RefreshActiveView<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#change Symbology</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ApplySymbologyFromLayer_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Buffer_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'C:\\Database_connections\\assesment_Model_lyr\\Buffer.lyr'</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ApplySymbologyFromLayer_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Holdings_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'C:\\Database_connections\\assesment_Model_lyr\\Holding.lyr'</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ApplySymbologyFromLayer_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Intersect_Layer'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'C:\\Database_connections\\assesment_Model_lyr\\Intersect.lyr'</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>RefreshActiveView<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#zoom to layer</SPAN>
<SPAN class="keyword token">print</SPAN> df
lyr <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListLayers<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN> df<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN> lyr<SPAN class="punctuation token">.</SPAN>name
extent <SPAN class="operator token">=</SPAN> lyr<SPAN class="punctuation token">.</SPAN>getExtent<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> extent
df<SPAN class="punctuation token">.</SPAN>extent <SPAN class="operator token">=</SPAN> extent
<SPAN class="comment token">#Export Map to PNG File</SPAN>
Png_output <SPAN class="operator token">=</SPAN> <SPAN class="string token">"N:\\GIS\Projects\\AA_Leith_Hawkins_TestBed\\"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">'.png'</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ExportToPNG<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">,</SPAN>Png_output<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'Map Created'</SPAN>
<SPAN class="keyword token">del</SPAN> mxd<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN><CODE><CODE><SPAN class="">Hi So I am working a project to create these maps and I am trying to get symbology to change but I cant <IMG src="https://us.v-cdn.net/6038851/uploads/legacyfs/online/emoticons/sad.png" />
</SPAN>
<CODE><SPAN class=""><BR />I cant work out where I need to call the Change symbology from ive had a look through the syntax guide but I think I must be a bit slow<BR /></SPAN><SPAN class=""><BR />Should I be calling the layer file or the layers I am adding to the Dataframe ??<BR /><BR /><BR /><BR /></SPAN><SPAN class=""></SPAN>