How to clip map sheets to a Map Gird

1855
11
02-03-2017 11:17 AM
JosephPlessis
New Contributor II

I have multiple geo referenced scanned maps from the 1950's, Like 60 of them.

I need to clip some white space off the edges so I can apply a fishnet.

So the main question is I have a 50k nts grid where the maps sit perfectly within each grid tile, When i try to clip the map to the grid it does nothing because it is reading the outside border of the nts grid. how would i get the clip to read each individual grid tile for a clip?

thanks

0 Kudos
11 Replies
DarrenWiens2
MVP Honored Contributor

Have you tried select (the grid polygon), then clip?

JosephPlessis
New Contributor II

I did selct a grid portion and created a layer form selcted data then proceeded to do the clip. 

Your way sounds easier.

Is there a way to script this for I have a lot of maps to do.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Yes, you could certainly do this with a Python script, looping through rasters, calculating raster centroid from extent, selecting the grid cell covering the centroid, doing the clip.

JosephPlessis
New Contributor II

is there any good resources to script this

0 Kudos
DarrenWiens2
MVP Honored Contributor

Start at the following link, get started on your script, and then post it back here when you need more help.

What is ArcPy?—ArcPy Get Started | ArcGIS Desktop 

Basically, figure out the geoprocessing tools you need, find and use the Python syntax on each tool's help page, and then put it in a for loop to repeat. But, first you need to figure out some Python.

NeilAyres
MVP Alum

But if these are scanned map sheets, why not load them into a mosaic, then use the map polygon grid as the footprints.

This will auto magically leave behind all the stuff around the edge.

JosephPlessis
New Contributor II

I like this idea!

So after i could split aprt the mosiac using split raster?

0 Kudos
AbdullahAnter
Occasional Contributor III

Prefect Answer,Neil Ayres Champion . It is it

0 Kudos
JosephPlessis
New Contributor II

so far i have this but no return on my clip

import arcpy

# Set the current workspace
arcpy.env.workspace = "Q:\\josephplessis\\GIS 307 Resource Managment\\Project\\Mapsheets\\soil"

#variables
R1 = "102I16"
R2 = "102I09"
R3 = "102I08"
R4 = "092L13"
R5 = "092L12"
R6 = "092L11"
R7 = "092L10"
R8 = "092L08"
R9 = "092L07"
R10 = "092L06"
R11 = "092L05"
R12 = "092L04"
R13 = "092L03"
R14 = "092L02"
R15 = "092L01"
R16 = "092E16"
R17 = "092E15"
R18 = "092E14"
R19 = "092E10"
R20 = "092E09"
R21 = "092E08"
R22 = "092E07"

# Local variables:
Output_Raster ="Q:\\josephplessis\\GIS 307 Resource Managment\\Project\\Geodatabases\\Grid_points.gdb\\gridlist.tif"

gridlist= R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16,R17,R18,R19,R20,R21,R22

grid="Q:\\josephplessis\\GIS 307 Resource Managment\\Project\\Geodatabases\\Grid_points.gdb\\GRID"

arcpy.MakeFeatureLayer_management(grid, "gridlyr")
arcpy.SelectLayerByAttribute_management("gridlyr", "NEW_SELECTION", " NTS_SNRC = 'gridlist' " )
print gridlist


# Get and print a list of TIFs from the workspace
rasters = arcpy.ListRasters("*", "TIF")
for raster in rasters:


print(raster)

while raster==gridlist:
arcpy.Clip_management("raster", Output_Raster, "gridlist", "", "", "NONE", "NO_MAINTAIN_EXTENT")

0 Kudos