ArcGIS Toolbox – Create a Custom Polygon Grid with ArcPy

Share Button

Updated – 7/15/2015
Fixed line movement from setting Overflow value, now based on slope
Updated – 2/27/2015
Fixed compatibility with Python 3 for ArcGIS Pro

(If you’re using Firefox, then right click and Save Link As)
Download the Custom Grid Toolbox – works with ArcGIS 10.1+
(contains 5 tools, 4 to make quarter and quarter quarter section grids with labels and 1 to make a custom grid)

(any donations go towards hosting costs)

View the Source Code:
Create Custom Grid
Create Q Sections script
Create QQ Sections script
Create Q Labels script
Create QQ Labels script

Watch how to use the Custom Grid Tools — Video Updated on 7-16-2015

So, maybe you’re doing an environmental analysis (check out my Create Random Points tool) and need to split a study area into equal plots? Or you work for a government agency and need to create a quarter or quarter section grid? Or you work for a utility company and need to split up an area in order to create features in correct locations? The possibilities are endless…

This tool allows a user to create a custom polygon grid of any size from an existing polygon feature class.
It loops through each polygon feature and splits it into whatever division was chosen.

This tool was created using Python, or more specifically ESRI’s ArcPy module.

Be sure to view the Tool Help within the tool dialog box for detailed instructions. Also, check the Geoprocessing Results for any error messages.

Here’s a screenshot of the parameters:
Custom Grid parameters

But, basically, you could take a polygon like this:

Custom Grid

And turn it into this:

Custom Grid split

Or maybe this:

Custom Grid split

Okay, enough of that. I think you get the point. I hope someone can find this tool useful.

Please leave a comment if you have any questions or problems, and be sure to check out the other tools I’ve created!

26 thoughts on “ArcGIS Toolbox – Create a Custom Polygon Grid with ArcPy

  1. Thanks for sharing your tools. I have used your QQ section tool as well as the custom grid and they work great. My question is about labeling custom grids. You have the script for labeling Q and QQ sections is there a way I could modify those scripts to label a custom grid?

    Thanks,

    Sean

    1. Sean- no problem! I’m glad you were able to make use of them. I’m sure it’s possible, but I haven’t sat down to figure it out because I never had a need. If I find time, I might try and figure it out. You are more than welcome to modify the code. What exactly are you using the custom grid for, and what type of labels are you needing? Do you need many different sizes, or just one custom grid size? Thanks for the comment!

      1. I am working on creating a custom grid based on QQ sections. Basically I am breaking the QQ sections down further to a 6×6 grid. I would like to be able to label those 36 polygons from 1 to 36. I work for a electric utility and we will be using it to referencing easements and structures (poles, underground facilities) within the grid. I have tired to modify the script by updating the lines that reference the 1-16 QQ sections in several places but I got bogged down in understanding how your are calculating the centroids for each polygon. Thanks for your help and sharing your scripts again.

        Sean

        1. Cool, I also work for an electric utility. So, you would only need the labels for a 6×6 grid. That makes it a lot easier than needing labels for many different sizes. If I find some time, I will try and put something together to do this and shoot you an email.

          1. I know this thread is a few years old now, but I’m looking for the same information. I work for a utility, and I’m trying to create a 10×10 grid within the QQ sections, labeled 0-9 in both directions. I am also having problems understanding how the polygon centroids are calculated in the labeling script. Ian, is it possible to describe in laymans’ terms how the script is doing that? Thank you so much for your time, and for creating these scripts in the first place.

  2. Hi Ian,
    I would LOVE to use your script – this is exactly what I am looking for. Unfortunately in the Create QQ Section I am not able to input the line feature class, I’ve just created. An error message “Failed to execute (CreateQQSections).” follows.
    I would very appreciate your help,
    Doreen

  3. Ian this is great and I really appreciate all your work and organization via the website and video. I enjoyed reading through all your other pages for insight.

    A quick note on the tool is that I left the Overflow at 0. I then took my polygon layer I wanted to split and then turned it into a polyline layer (Sections in Texas). I then merged the resulting layer from your tool (QTR QTR of Texas sections) and the polyline layer of the sections. I then used the “Extend Line (Editing)” tool. This helped “grow the lines into the gaps” as the injected Section lines now act as a bounding box because they are in one layer. I then used the “Trim Line (Editing)” tool to clean up the dangles.

    It over all came out real clean and I just had to spend about and hour on 11 Counties in texas to manually clean up some dangles.

    I am now splitting my original polygon section layer with this final clean polyline layer. That should take probably 2 days as it is 11 counties in Texas with QTR QTR (8 parts)…..it’s a lot! I’ll let you know how long the split took.

    Thanks again as your work and great presentation was the foundation to make my analysis possible. I hope you get some recognition from the industry by presenting on this or finding some contract work via your website.

    1. Hi Dylan, thanks for the comment!

      It sounds like you got it under control. Thanks for providing your workflow, I’m sure it could help someone else out! Yeah, 11 counties is definitely a lot of sections. I hope everything works out with the splitting. It can be frustrating that it takes so long. I’d definitely be curious to hear how long it took. Anyway, hope the rest of your analysis goes well.

  4. Hi Ian,

    I am trying to create a custom grid that does not necessarily fit a perfect square, i.e.5 x 5 or even a rectangle, but rather more of an odd shape like an L or something (much like the one in your video screenshot preview with random appendages if you will). Is there a way to do this with this tool? If not any advice for how I might create it?

  5. Hello Ian,
    Fantastic tool and a real time saver….except the split polygon tool doesn’t engage on my version of ArcMap HELP. I created the Q_Sec, QQ_sec and even stand-up lateral lines, everything looks great BUT when it comes time to create polygons the split tool is only available in the standard and advanced versions of ArcMap. Sadly I’m a one man shop and cant afford the $7000 version. Any work arounds in your tool to create polygons without the split tool would be greatly appreciated.

  6. Hi Ian,

    This tool works great except for one quandry. I have two Indian Boundary Lines running through my Townships. Due to this, all of the polygons along the IBL do not split correctly. I mainly need this tool for the QQ split, as I have the Q split already. I am trying to finagle something.

  7. Hi ian, i hope all is well, i’m trying to create a qq section grid across a irregular shape (not necessarily a square) that fits best within a shape and also i’d like to define the direction of the sqqq if possible given the bearing of the shape.

    Do you have any ideas on how to do this? Its ok if the qq is not perfect squares across the edges. Thanks!

  8. Hey Ian, This is an amazing tool.
    I used it for a custom split on USNG UTM Grid and it worked like a charm.
    Having a little hard time understanding the labeling but I will figure it out.
    Thanks again for you efforts.

Leave a Reply