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)

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!

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

  1. Sean
    October 20, 2014 at 8:33 pm

    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. Ian
      October 21, 2014 at 10:14 pm

      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. Sean
        October 22, 2014 at 2:24 pm

        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. Ian
          October 25, 2014 at 9:03 pm

          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.

  2. Doreen
    March 27, 2015 at 12:24 pm

    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

    1. Ian
      April 2, 2015 at 7:56 am

      Hi Doreen- I’ve sent you an email.

  3. September 3, 2015 at 11:13 am

    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. Ian
      September 6, 2015 at 1:23 am

      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. Jason
    September 4, 2015 at 10:38 am

    This is way better than the Fishnet tool! You’ve saved me hours of work. Thanks!

    1. Ian
      September 5, 2015 at 11:45 pm

      Hi Jason, thanks for the comment, glad you like it!

  5. Beka
    June 6, 2016 at 10:51 am

    Hi, thanks for creating useful tools. Is there possibility to create labels for custom grids?

  6. ahmed
    June 15, 2016 at 12:11 am

    Hi Ian,

    thanks for the useful tool, i have one question, can i use it as web app ?

    1. Ian
      June 19, 2016 at 8:07 pm

      Hi Ahmed, thanks for the comment, and I’m glad you’re finding it useful! I’ve sent you an email.

  7. Joe
    September 14, 2016 at 1:55 pm

    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?

    1. Ian
      September 14, 2016 at 5:30 pm

      Hi Joe, thanks for the comment. I’ve sent you an email to get some more information.

  8. MJ
    September 23, 2016 at 9:44 am

    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.

    1. Ian
      October 16, 2016 at 9:52 pm

      Sorry, MJ, but I’m not aware of any other way currently. If I think of anything, then I’ll let you know.

  9. Michael
    November 29, 2016 at 11:57 am

    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.

Leave a Reply

Your email address will not be published.