The indisputable “face” of GIS, maps are informative, artistic, and surprisingly more complex than the casual viewer realizes. LOGIC’s energy clients frequently need to visualize landownership parcels on a map, so our team—like many GIS developers—must often find corner points to align polygons with legal descriptions.
To better understand the complexity of this critical task, we sat down with our own Greg Duvall, GIS Developer at LOGIC Solutions Group, to get his take on a few tried-and-true methods for finding corner points.
LOGIC: A map is defined as a diagrammatic representation of an area of land or sea showing physical features, cities, roads, etc. What sorts of things do energy clients in upstream oil and gas tend to request on a map?
Greg: Roads, facility layouts, pipelines… and land ownership. Both the Legal and Land departments need to see precise views of land ownership parcels. This can get really tricky in Texas, but for about two-thirds of the U.S., it’s a bit easier to quarter.
LOGIC: Quarter? Can you elaborate?
Greg: Quartering is a concept used in land management. Legal descriptions – for example, the terms of a contract for drilling rights – often break pieces of our national land system into quarters, down to the quarter-quarter-quarter, which would be about 2.5 acres of land. We have to represent these parcels, these quarters, on maps often. And it’s not always a simple process to align land ownership with the map.
LOGIC: Why is that?
Greg: Representing quarters on a map often involves finding corner points. Sometimes, the corner points need to align with ordinal directions—NE, SE, NW, and SW—but other times, they could be anywhere. You have to decide what makes sense for your map and ask yourself, do I stick to 4 corners, or could there be more? The question sounds simple, but it’s a hurdle I’ve faced several times in my career as a GIS developer: how do you find corner points?
LOGIC: So, how do you? Have you found any standout methods?
Greg: Of course, that’s why I’m here! The first method I’ve tried—these aren’t foolproof, by the way—just throwing that disclaimer out there.
LOGIC: Fair enough 😊
Greg: So, I’ll back up and let you know…I’m usually developing with C#—that’s .NET—in ArcGIS Pro SDK, or JavaScript with the ArcGIS JavaScript API. Ok, so, the first method is the Simple Angle Method.
Step through each vertex in the polygon.
Grab the previous, current, and next vertices.
Calculate the angle of the 3 points.
You can do that with the following formula:
Angle = arctan2 (next.Y—current.Y, next.X—current.X)
— arctan2 (previous.Y—current.Y, previous.X—previous.X)
This will give you the angle in Radians.
If your angle is negative, you can add 2π to your result to make it positive.
To convert to degrees, either use an Esri API, or multiple by 180 / π.
Anything less than 60 degrees or more than 120 degrees is not a corner.
LOGIC: Fun with numbers… and here I thought we were just drawing maps!
Greg: (chuckles) Well, this method can be problematic, because there are situations where there may be many sides, vertices, and angles that fit the criteria of a corner. So I’ll share with you another method I’ve used, the Comparison Angle Method.
Same as steps 1-4 above.
Store each of the angles with the current vertex in a data structure.
Sort the data structure by angles closest to 90 degrees.
Greg: This method is still not perfect, because, with shapes like octagons, there may not be any angles that are “closest to 90 degrees”. With that in mind, you could conceive of situations where your corners are bunched together and not spread out, or they could all be considered corners if you do not have a limit on the number of corners you are calculating.
Greg: So that brings me to my final method, the Envelope Method. With ArcGIS Pro SDK, this is an amazingly simple method that I have found works most of the time.
Find the extent of the polygon (envelope).
Create points for NE, NW, SE, SW by using the Minimums and Maximums of the envelope.
Call the GeometryEngine’s NearestVertex method and find the nearest points on the polygon to the 4 points you’ve created.
Greg: Now you have somewhat accurate corner points for your polygon. I like this method because it puts the points in the right places, and it’s very easy to implement.
LOGIC: This sounds like the best route—no math!
Greg: Ha! Yes, that’s definitely an added bonus. There are a few other methods I’m aware of, such as using the Arcade Expression for calculating angles instead of the formula I shared or using the Python Angle method.
LOGIC: Sounds like you’ve found a few great methods that work well for you, thanks for sharing with our readers.
Greg: Happy to do so! I just wish there were a more precise method. If you’re quartering, you’ll probably want the ordinal direction corners, and some combination of the 3 algorithms above will get you near perfect. In other situations, you may have to come up with a new solution. Maybe I’ll crack the code on an exact method soon.
Finding corner points is a valuable and often overlooked complexity necessary for best serving the needs of LOGIC’s energy clients; we are grateful to have the knowledge shared by Greg today on our team.
These kinds of insights can help you fast-track the adoption of GIS across your organization. Contact us today for a deeper dive into the seemingly innocuous complexities of GIS in today’s evolving technology landscape.