![]() |
split a grid into its tiles with tried codes - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: split a grid into its tiles with tried codes (/thread-3656.html) |
split a grid into its tiles with tried codes - babakkasraie - Jun-11-2017 Hello I have a grid shapefile that contains 10 polygon squares. I need to select each tile (which is a row in the attribute table) and make a separate shapefile. It means I need to create 10 separate shpefiles from the grid. How can I make a loop to go through rows and select each row and make a polygon shapefile out of it? I tried the following codes unsuccessfully. Thanks for help. # Import arcpy module import arcpy # Local variables: This is the Grid Mapsheet_grid_50K = "Mapsheet_grid_50K" # The following loop is supposed to go through rows rows = arcpy.SearchCursor(Mapsheet_grid_50K) row = rows.next() while row: Expression = "\"FID\" = row" #This expression is used is the following select method arcpy.Select_analysis(Mapsheet_grid_50K, Mapsheet_grid_50K_Select_shp, row)# This select method will select each tiles # This is a separated single tile Mapsheet_grid_50K_Select_row_shp = "F:\\Canada_DSM_ForTestOnly\\PersonalData&Maps\\map_Tiles\\Mapsheet_grid_50K_Select."+row+".shp" del row del rows RE: split a grid into its tiles with tried codes - Larz60+ - Jun-11-2017 seems to be fairly explained here: https://gis.stackexchange.com/questions/85448/creating-polygon-shapefile-from-list-of-x-y-coordinates-using-python RE: split a grid into its tiles with tried codes - babakkasraie - Jun-11-2017 Thanks, I will try to learn from it |