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
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.
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.
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.
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.
53 thoughts on “Creating a Quarter Quarter Section Grid with Python”