2

OK. well this is silly, in that there is no way it should be as difficult as it has been for me to find information regarding how to generate a polygon tile index from multiple vector (contour) tiles. With web publishing, tilecaches, etc. all the search results are not what im looking for.

I have a folder full of about 50 contour shapefiles tiles that combined cover a US county. However there was no index distributed with the contour file collection, so I need to create one based on the bounding boxes, convex hulls, or some other function for each contour tile, and merge those together in a meaningful layer to be used to locate tiles necessary for a particular area...

I'm failing to see a tool to do this in either QGIS or ESRI? I must be missing something so if someone could point me in the right direction, that would be great.

Thanks

1

If the contour files are already tiled and don't overlap you could use a bounding box tool (i.e. Creates a shape file of the bounding box of an input file) for each contour file and then Append the boxes. A simple script could be used for the operation if you have too many contour files to do it manually.

Whitebox GAT has a bounding box tool (Layer Footprint) that would work well for this workflow. Here is a Whitebox script (in Python) that would do what you want if all the files are contained within one directory:

from whitebox.geospatialfiles import ShapeFile
from whitebox.utilities import FileUtilities

directory = "/Directory/Files/Are/In/"
outputFile = "/Directory/Files/Are/In/YourOutputFile.shp"

files = FileUtilities.findAllFilesWithExtension(directory, ".shp", False)

# find the bounding boxes of each shapefile in the directory
boxFiles = []
for f in files:
    bbFile = f.replace(".shp", "_bb.shp")
    args = [f, bbFile]
    boxFiles.append(bbFile)
    pluginHost.runPlugin("LayerFootprint", args, False, True) # this is the bounding box operation

# create a string containing each file name
s = ""
for f in boxFiles:
    s += f + ";"

s = s[:-1]

# append the files together
args = [s, outputFile]
pluginHost.runPlugin("Append", args, False, False)

# now clean up the files
args = [s]
pluginHost.runPlugin("DeleteFiles", args, False, True)
0

Would Create Fishnet (ArcGIS) work for your purposes? It will create a gridded polygon feature class for whatever extents you give it. You can also select a tile size, and with some finagling you can center it over your data quite nicely. I can show you how if you think this might solve your problem.

0

You can create a model in ArcGIS to do this. Actually, you need to create two models: a nested submodel and the full model.

  1. Make sure that each contour featureclass has a text field with the name of the featureclass (e.g. Contours1, Contours2...). If there are any differences in the fields, you will not be able to transfer that information to the merge output. Alternatively, you can skip the unique naming part now and create your own naming convention after the model produces the merge output.
  2. Create a submodel to iterate through a workspace, calculate the feature envelope and collect all of the paths to the feature envelopes. Note that the workspace and Output Values variables are selected as parameters. I opted to use the in_memory workspace for the intermediate data, as it is much faster and saves space (See screenshot). enter image description here enter image description here
  3. Create the full model by attaching the submodel output to the merge tool.

enter image description here

  • 1
    Nice solution! :) – WhiteboxDev Aug 10 '14 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.