Creating a Quarter Quarter Section Grid with Python

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

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

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 I needed 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 facilities and customers. It all depends on what you need.

Section To QQ

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

To do this, I created a da.SearchCursor on the Nebraska section grid which looped through each polygon and used its SHAPE (geometry) field to record the coordinates of each vertex in the polygon. 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 polygon extent. 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 da.InsertCursor was then used to insert each Polyline object into a new polyline feature class.

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

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 were the same for each qq-section.

Quarter Quarter Numbers

While thinking of how to do this, I realized I already had what I needed. 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 da.SearchCursor on the SHAPE field to loop through each qq-section and find the coordinates of each corner. From there I was able to find the centroid coordinates for each qq-section. This allowed me to record which label was linked to which quarter quarter section as shown above.

As the centroid was calculated for each qq-section, I also created a Point geometry object for each one. I then used an InsertCursor to insert each point object along with its appropriate label attribute into a new point feature class.

Lastly, I did a spatial join on the newly created point feature class and the previously created qq-section grid. This outputted a new quarter quarter section grid with the appropriate label joined to it.


I decided to get rid of the hardcoding and make these tools available through an ArcMap Toolbox, so others can utilize them. I’ve also made two similar scripts for creating a quarter section grid and labels. If you didn’t notice, the Custom Grid 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.

35 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!

  11. Brandon
    April 9, 2015 at 9:18 am

    Hey Ian,

    Thank you for making this very useful tool. I really appreciate it. I was quite tired of having to eyeball quarters of quarters, and you’ve made that a thing of the past with your python tool.

    I’m having a little issue with the Q Label maker and I wanted to know if you might have any idea on a fix.

    Here is an image to what my labels look like upon completion.

    Image of the full extent of the map in case it has to do with some of the irregularities.

    Geographic Coordinate System: GCS_North_American_1983
    Datum: D_North_American_1983

    I’m a little new to GIS, so I’m sure what specifications will help you.

    Anyways, if you can help I appreciate it. If not, you’ve already given me a great tool.

    Thanks Ian.

    1. Ian
      April 10, 2015 at 12:10 pm

      Hi Brandon, I’m not sure what’s wrong without getting a little more information. I’ve sent you an email.

  12. Larry
    May 6, 2015 at 9:52 am

    Ian…great tool. I’m tasked with using survey-grade section polygons to sub-divide into both quarters, and quarter-quarters. I wanted to test your tool but need a little assistance with the parameter allocations. Also, I am trying it out on (1) section poly…will it still work? Is there any specific edits to the script needed? Thanks for any help.

  13. Chris Caird
    June 1, 2015 at 11:14 am

    Hi Ian,

    I love your tool. I’m wondering if you can explain how the ‘Create QQ Sections’ lines created for subdividing get shifted as their lenght changes.
    Example: If the Overflow is set to 0 the first run and than the overflow is set to 50ft on the second running, The line will shift several degrees on an axis point rather than just extending off the current line.

    I hope this question makes sense. I appreciate your time and your tool. I love it.


    1. Ian
      July 16, 2015 at 6:19 pm

      Hey Chris- this was due to me being on a deadline when I first created the tool. The way I did it was not the best, but it worked for me at the time. I simply added the Overflow value to the XY values of the points, which is not the correct way to do it. It’s always bugged me, and I’ve finally taken the time to fix this problem. Thanks for the comment!

  14. Matt Haffner
    June 12, 2015 at 11:40 am

    Hey Ian,

    Thanks so much for the toolbox and scripts. The toolbox works perfectly for me, but I’m wanting to use python scripts to run the function (for the sake of creating a more documented, reproducible process). I’m using, and I’m having trouble understanding how the inputs/outputs are structured, especially with the use of arcpy.GetParameterAsText(). Any help would be greatly appreciated.


    1. Ian
      June 13, 2015 at 3:05 pm

      Hi Matt, thanks for the comment. I’ve sent you an email.

  15. Jerry
    July 13, 2015 at 10:18 am

    Hi Ian, This sounds like a great tool, however, I’ve downloaded the CustomGridTools and when attempting to use the CreateQQSections the Input and Outputs are different than the video and the generated lines are not closed as they should be by the inputed poly sections; any chance you have an update toolbox?

    1. Ian
      July 16, 2015 at 8:00 pm

      Hey Jerry- I’ve just updated the video. I’ve been meaning to update it for awhile, but couldn’t find time. Hopefully it makes more sense! I’ve also updated the toolbox, so you’ll need to download the new one. Let me know if you have any problems!

  16. Trahe
    October 16, 2015 at 1:42 pm

    YOU ARE A GOD !!!!!!!!!! Thank you soooooooooooooooooooooooo much!!!!

  17. Toby
    November 11, 2015 at 9:57 am

    Great tool. However, I am having difficulties trying to get the quarter labels to work.

    Most of the Gridlabels are null, though some are populated. And those that are populated are done correctly too. It is maybe 75% null. Running the script produced no errors. Also, I am working from a gdb on 10.3.

    I am really scratching my head here.

    1. Ian
      November 12, 2015 at 6:19 pm

      Hi Toby, and thanks! I’m not sure what’s wrong. You do have to have a space after the comma in the label parameter. Could that be the problem? I’ve sent you an email.

Leave a Reply

Your email address will not be published.