Creating a Quarter Quarter Section Grid with Python

Share Button

Updated – 2/27/2015
Fixed compatibility with Python 3 for ArcGIS Pro
Updated – 8/18/2014
Fixed a bug with the Overflow parameter

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

This YouTube video is out-of-date, but still gives a good idea on how the tool works.

I was tasked with creating a quarter quarter section grid for a few Nebraska counties because the BLM didn’t have one available. They did have a section grid though. So, basically, I had to split each section grid into 16 parts and also add an attribute that will be used as a label for each quarter quarter section grid. Also, I know this isn’t a substitute for an actual survey grade quarter quarter section grid, but sometimes you’re required to work with what you have. And in this case, the quarter quarter section grid will be used by an electric utility to name their equipment and customers, so they actually prefer the sections to be split equally. It all depends on what you need.

Section To QQ

I needed to create quarter quarter sections for about 3000 sections in Nebraska, so doing it manually was out of the question. Using Python was the only reasonable solution.

To do this, I created a search cursor on the Nebraska section grid which looped through each individual polygon and used its Shape geometry field to record the coordinates of each vertex in the polygon. At the same time, it also recorded the coordinates of each corner for the extent of the polygon.

After finding the coordinates of each vertex, I then found the distance of each vertex from each corner of the extent of the polygon. This allowed me to find which vertex corresponded to which corner. A little math was then performed to determine the coordinates of each quarter quarter section along the outside of the section grid, as show below.

Quarter Quarter Sides

Next, I created a Polyline geometry object and had it connect each point to the one directly across from it. An insert cursor was then used to insert each Polyline object into a new polyline feature class.

I then manually used the Split Polygons tool inside ArcMap in the Advanced Editing toolbar to split each section based on the polylines previously created. It was necessary to use a Cluster Tolerance of about 30 feet, but this will vary based on the grid used. This is because if the polygon had more than just one vertex at each corner, there could possibly be a gap between the end of the created polylines and the polygon border. After applying the Cluster Tolerance, I was left with exactly what I needed, but I still wasn’t done.

Part II

I also needed to attribute each quarter quarter section a specific number to be used as a label. The good news is that the numbers are the same for each section.

Quarter Quarter Numbers

While thinking of how to do this, I realized I already had what I needed to create it. I just needed to do a little more math in order to find the centroid of each quarter quarter section. This script was similar to the first one. I used a search cursor to loop through each polygon and read the Shape geometry field to find the coordinates of each corner. From there I was able to find the centroid coordinates of each quarter quarter section, so I knew where each centroid was located within the polygon. This allowed me to record which label was linked to which quarter quarter section as shown above.

As I found the centroid for each quarter quarter section, I created a Point geometry object for each one. I then used an insert cursor to insert each Point object along with its appropriate label attribute into a new point feature class.

Finally, I added the newly created point feature class and the previously created quarter quarter section grid to ArcMap and performed a spatial join. This outputted a new quarter quarter section grid with the appropriate label joined to it.


I decided to go ahead and get rid of the hardcoding and make these scripts available through an ArcGIS Toolbox, so other people can utilize them. I also made two similar scripts for creating quarter section grids and labels. If you didn’t notice, the Toolbox is available for download at the top of this page.

I hope someone finds these scripts useful. If there are any questions or problems, please leave a comment and I’ll try to help.

21 thoughts on “Creating a Quarter Quarter Section Grid with Python

  1. Dan Norris
    February 19, 2014 at 11:42 am

    This is fantastic! After searching for a long time for a tool to break up sections and finding nothing but disappointment, I found this. This tool does exactly what I was hoping to do and will make it so much easier to find and plot approximate property boundaries. Kudos to you for not only figuring it out, but also posting the code and even the toolbox. The graphical interface makes it remarkably easy. I processed the entire state of Missouri (several million quarter-quarter sections) and it only took a few hours to run.

    1. Ian
      March 25, 2014 at 3:22 pm

      Dan, thank you for your kind words! I’m glad you were able to put it to good use.

  2. Maggie
    March 25, 2014 at 2:23 pm

    Hi Ian,

    First off, wow. It looks like you put a lot of time into these tools; thanks a lot! I am currently being faced with a similar task. I need to create 3 lat/long grids with varying resolution: 1/4 degree, 1/20 degree, and 1/100 degree. I have already created just a 1 degree shapefile using the CreateFishnet tool, which I had to do 16 separate times then merge due to the size limit the tool has. I can only imagine how much of a pain it would be to do the same process for the higher res grids. It looks like the quarter tool would be applicable to the 1/4 degree res, but I’m wondering, could we modify the tool to divide each cell into 1/20ths, then 1/100ths? Or possibly make that another variable? Looking at the two create sections python scripts, it doesn’t look like the latter would be a viable option as it stands, but honestly it’s a little bit over my head so I’m not sure I’d know how to modify the code myself. I’m not even sure this is the best way to go about this at all because the number of cells is so large, but maybe you could help me out.

    Thanks a bunch!

    PS: Clicking the link to download the toolbox doesn’t seem to be working, it just opens in the browser…am I missing something?

    1. Ian
      March 26, 2014 at 11:47 am

      Hi Maggie,

      The toolbox downloads fine for me. You might try right clicking on the link and doing a Save As or Save Link As.

      As for your question, creating higher resolution grids from the code I posted would definitely be possible. It would just require some more division. Creating a function to do this would be the way to go. I’m not sure if you are creating your lat/long grids based on an existing grid or a feature though. If I find some time, I’ll shoot you an email to get some more information.

      1. Maggie
        March 26, 2014 at 5:49 pm

        Yes duh, that worked, I can’t believe I didn’t try that.

        That would be so helpful! I would need some guidance, but I think it would be useful to do for people who need to split grids into various higher resolutions (I can’t be the only one, right?).

        Anyways, I have a shapefile of lat/long 1 degree, in which each cell is represented as a polygon. (180 * 360 total polygons). I need to split all of the polygons in this shapefile such that each cell is divided into 16ths (so I guess using your quarter quarter script). I’m not sure if this answers your question, but if you get the chance I would love to hear from you.


      2. Maggie
        March 27, 2014 at 11:42 am


        Just wanted to let you know that I’m going to go about my task in a different way, so no need to spend time helping me modify the algorithm. I’m sure this tool will still be very useful to me in the future however, and I’m glad to have discovered your webpage! Thanks again for sharing your ideas.

        1. Ian
          March 29, 2014 at 1:58 pm

          I’m glad you got something figured out! I just want to let you know that I added a new tool to the toolbox called Create Custom Grid and I’ve renamed the toolbox from Section Grid Tools to Custom Grid Tools. The new tool allows you to choose a vertical and horizontal division. So you could create a 1/20 by entering either 5×4 or 4×5 in the tool parameters. I hope you find the tool useful in the future and thank you for your comments and having input on the additional functionality. The new toolbox can be downloaded at the top of this page.

  3. Grant
    April 10, 2014 at 3:52 pm

    I’ve been looking for a tool like this, thanks! Any chance you could make the source code available? Looks like the script is embedded in the toolbox.

    1. Ian
      April 10, 2014 at 11:44 pm

      Grant, sorry about that. I updated the scripts recently and forgot to post them again. I’ve added them to the top the page. Thanks for reminding me and I hope you find them useful.

  4. Tom
    April 29, 2014 at 4:28 pm


    Absolutely perfect for what I needed. You are the man!!!! I needed something to split Quarter Quads for NAIP imagery, and this was PERFECT!

    Great job!


    1. Ian
      May 1, 2014 at 10:18 am

      Thanks, Tom! I’m always interested in hearing the different ways people are using the tools, so I appreciate you letting me know!

  5. bill@TLH
    May 14, 2014 at 9:32 am

    Impressive and very helpful; well done.
    Keep ‘em, coming!

  6. Mark
    June 23, 2014 at 10:57 am

    Can it be tweaked to wok with quarter sections (split polygons into 4 equal polygons)?

  7. Mark
    June 23, 2014 at 11:31 am

    oops – ignore may comment – didn’t see th QQ option. This works fantastic.
    Thank You

    1. Ian
      July 14, 2014 at 8:56 pm

      Thanks, Mark, glad it worked for you!

  8. jake
    July 14, 2014 at 9:49 am

    I am having to split STR into QQ as part of an assignment for class, and ran across this website. I guess i’m missing a step or doing something wrong though cause once I get to the point of editing the lines after creating them, using the create QQ sections I get stuck. my advanced edit toolbar will not allow me to click on the split poly tool.

    1. jake
      July 14, 2014 at 9:56 am

      Nevermind my last post, I figured out that it is a licensing issue.

  9. peter
    October 25, 2014 at 7:30 pm

    Thanks for creating these scripts. I have a question. I tried running the Create QQ Sections and I get an error saying “The table was not found. [GDB_DataChanges]”. Do you know off hand what the problem is? Thanks for any help you can give.

    1. Ian
      October 25, 2014 at 8:57 pm

      Hi, Peter! I’m not familiar with that error, and Google didn’t provide much help. Where is your data being stored? File, personal, or SDE geodatabase? You could try exporting the polygon feature class that you’re inputting into the Create QQ Section tool into a new file or personal geodatabase, and run it from there.

      Also, if you want, you can go to the Contact tab at the top of my site and email me the data, and I will try to create the QQ sections. Please let me know if you can’t get it to work. Thanks!

  10. December 17, 2014 at 9:50 am

    Awesome tools. Thank you!

    1. Ian
      December 18, 2014 at 9:32 am

      Thanks, Chris!

Leave a Reply

Your email address will not be published.