Howdy,
I'm currently attempting to 'tile' a line shapefile (a river & stream layer) by selecting the line features which are contained within bounding rectangles. These bounding rectangles comprise a fishnet which has been converted to a polygon shapefile. The fishnet's attribute table is populated by values for the upper left and bottom right geographic coordinates of each individual bounding rectangle. The fishnet is 60x60, therefore the output should be 3600 individual line shapefiles. Unfortunately, I only have the single, giant 60x60 fishnet. Even if I decided to make small extent rectangles to do the query, I would need 3600 of them...
I need to write a Python script which will accomplish this task, and was considering gp.selectlayerbyattribute or gp.selectlayerbylocation. I could also use gp.searchcursor to grab the coordinates of each rectangle. However, I'm not quite sure how to select features from one layer based upon the attributes or location of another layer using Python (nor do I think that such a query would work for my project). I also do not know how I would use the coordinate output of gp.searchcursor for a spatial query in Python. Hope this all makes sense.
It would be easy to loop this 3600 times if I knew how to go about selecting the features. I'll eventually have to convert the 3600 .shp files to .lyr, and then do a Layer to KML in Python..... but that requires no more than 10 lines of code, which I already have.
Any suggestions?
Much appreciated,
Craig