Posts Tagged ‘polygon’

2 ways to create a multipart polygon

Problem: You need to create a second distinct polygon that is attached to the same record in the attribute table.

A multipart polygon is a group of polygons that have gaps between them, but only one attribute table entry (and therefore only one object ID). They might be used in a case where there are multiple buildings on the same parcel, multiple zones of influence for the same actor, or multiple lilypads on the same pond. If all the attributes are the same, might as well use the same record for all, instead of a long list of repeating values. You will know you are dealing with multipart features if you click on one polygon to select or identify it, and other polygons light up too. But how do you create one?

I know of two ways: one I have been doing for a long time and another I just learned. I will start with the new way, although I think I still prefer the old. Both sets of instructions assume you have already digitized the first polygon.

Tacking on a multipart, Way #1:

  1. With the editor tool (black arrow), select your polygon.
  2. Change the edit Task to Modify Feature.
  3. Switch to the sketch tool (yellow pencil). Lines will extend out between your starting and ending vertices.
  4. Hover over one of these vertices and right click to Finish Part.
  5. Digitize your next polygon like normal. When you have created the final vertex, right click to Finish Sketch.

Or, select Finish Part if you want to create additional polygons in the multipart feature. Finish Sketch when you’re done creating the last one.

You have to follow these steps exactly as I have written them or it won’t work. I find this procedure a little nit-picky but it may just be because I am not used to it yet. The only advantage I can think of is that you never end up of creating a second attribute record this way, which may help in keeping object IDs straight.

Tacking on a multipart, Way #2:

  1. Digitize your second polygon in the normal way.
  2. With the Edit tool, hold down the Shift Key to select both polygons.
    (Or, click and drag to draw a box around them)
  3. Select Merge from the Editor menu.


Try them both and pick your favorite!

Tags: ,

Creating a doughnut polygon

Problem: You need to cut a hole out of a polygon

This comes up a lot. Perhaps you’re digitizing a lake, and it has an island in the middle of it. Or there’s an area of lawn surrounding a building. If you’re starting from scratch, I recommend drawing lines and converting them to polygons. Similarly, if you need to make a lot of holes, I recommend converting your polygons into lines, editing the lines, then converting back to polygons. That method is simpler for large scale changes.

But sometimes you just need a quick hole or two right now. For instance, you might be working in the Planning Office for the city of Lansing, Michigan. You might be in charge of maintaining their Existing Land Use Map, shown below.

In the southwest quadrant of the map, there is one region of Institutional land that has a Single Residence in the middle. Let’s pretend that house was just built, and you’ve been asked to update the map.

Here’s how you could do it:

1. Make your Land Use polygon layer partially transparent so you can see what you’re doing underneath.

Howto: Right click on the layer in the Table of Contents to bring up Layer Properties. On the Display tab, enter a number greater than 0 and less than 100 in the Transparent % box. 50% is good.

2. Enable editing and double click on the Institutional polygon to show the sketch vertices. Note: Double clicking brings you into Modify Feature mode, allowing you to move vertices in the existing polygon. A single click is Create Feature mode, which draws a new polygon.

3. Right click on the edge of the sketch, near where you want to create the hole, to Insert Vertex. Then create two more vertices next to it.

4. Pull the center vertex in towards one of the outer corners of your hole.

5. Create as many new vertices as needed to drag out to all of the other corners.

6. Prepare to close the empty space and the filled in space by placing two vertices at each location close to another. You’ll end up with a narrow rectangle connecting the edge of the filled space with the edge of the empty space.

7. The idea is to turn this rectangle into a line by merging the vertices at the top and bottom. To do this, turn on snapping to sketch vertices.

Howto: Select snapping from the Editor drop down menu and check the Edit sketch vertices box.

8. Pull the vertices together.

When you click away, that connecting line will disappear, giving you the two distinct areas you want. Now, it’s a simple matter to draw a new polygon for the Residential area within that hole. Just snap to its four corners.

Make sure that snapping to the editable layer, and not just the sketch, is turned on for this.

Note: If you are just creating a visual map, you can draw the smaller polygon on top of the larger, and then set Symbol Levels to ensure they display correctly. (Symbol levels are available from the Advanced drop down in the Symbology tab of the Layer Properties dialog). This is a quick fix if you’re on a tight deadline. It is not recommend if you’re going to be doing analysis on the layer or distributing it to others.

Another Note: There are other ways to do this, such as using the Cut Polygon Features task (for a hole), or the Clip task (for a polygon inside a polygon). ArcMap’s Help describes both of these methods. I like following the steps I have outlined because I can accomplish everything by clicking and dragging without switching between editing tasks. Within GIS, there are many ways to do most things, and you will develop your own style.

Tags: ,

Calculating Polygon Areas

Problem: You need to get the areas of your polygons

I have often been asked questions like “What is the total acreage of forest in our study area?” or, “Has the total forested area increased or decreased since we last mapped it two years ago?” The answer starts with being able to calculate polygon areas. After that it’s just addition and subtraction.

I used to have to use VBA scripting to calculate polygon areas. Now the task has been simplified with the Calculate Geometry tool introduced in ArcMap 9.2. However, there are some things you need to know to get good results with this tool.

There’s a lot of little parks around the San Francisco bay area in California that will serve as a good test case.

Let’s add the area of each park to the attribute table. The first step is to create a new field to hold the values. Chose field type “Double” (Double-precision floating-point number) which allows lots of decimal places. Then, right click on the field name and chose “Calculate Geometry…” from the context menu. You will then get to choose your units. In this case, decimal degrees are the only option because the layer is in a geographic coordinate system. Decimal degrees are pretty useless.

Fortunately, the tool allows you to use the coordinate system of the data frame, so you don’t have to worry about re-projecting. You just need to change the data frame into a projected coordinate system, one that uses a linear unit of measure, such as feet or meters. UTM (Universal Transverse Mercator) is widely used. This image from wikipedia shows the San Francisco bay area is in UTM zone 10N.

To change the projection of the data frame, select Data Frame Properties from the View menu. On the Coordinate System tab, pick from the Predefined – Projected Coordinate Systems folder.

Now, the Calculate Geometry tool gives you choices like square feet, square miles and acres. I picked acres, a good tiny park sized unit. I got results back with 6 decimal digits, which sure seems good.

But wait. We used a common projection which is great for most purposes, but not particularly for this one. UTM preserves shape and direction, which makes things look right on maps. However, it distorts area and distance. Exactly not what is needed here. The distortions may be small, but if you want to be as accurate as possible (and what GIS Analyst doesn’t?) it is better to use an equal-area projection. Albers projections preserve area while distorting shape and distance. If you root around in the list, you’ll notice there’s several Albers equal-area projections available for different regions, such as Albers North America and Albers USA Contiguous. It is best to pick the most local one you can find. In the State Systems folder, there’s a California (Teale) Albers. Perfect!

Changing the data frame to this, and recalculating the area in a second field, does yield different, better results.

If you need to get the total area of all the parks, don’t dig out your calculator. Just right click the field name to run the Statistics tool.

Tags: , ,

Creating a continuous surface of polygons

The problem: You need to digitize adjacent polygons

This isn’t as straightforward as it initially appears. If you need to digitize some points of interest, you create an empty point layer and start clicking away. If you need to digitize some river or road lines, you create an empty line layer and start tracing. But if you follow the same logic to create polygons, unless those polygons don’t touch, you’re going to run into trouble.

Polygons that are separate from one another, such as building footprints or lakes, no problem. But polygons that form a continuous surface, such as landcover, administrative areas (e.g. counties, zip codes), soil types, or flood plains, big problem.

Why? Well, let’s take the example of a soil map. I downloaded this one from the Antrim County Community Center. It’s a 1928 Soil Survey of Antrim County, Michigan.

I zoomed in on an area of Antrim gravelly sandy loam, and drew my first polygon. Then I created a second polygon for the Lupton muck next to it.

Looks fine, except when we zoom in. The polygons don’t line up. Those empty spaces in between are called slivers. They are to be avoided at all costs. They will mess up feature counts and calculations of areas. They don’t represent the real world, and they look bad. However, they are virtually impossible to avoid if you are digitizing in this manner. You can try to by zooming really far in while you are drawing, and being really careful, but what a headache! Fortunately, the cost is not that high.

One way to avoid slivers is by the use of snapping. The snapping toolbar is available from the Editor dropdown menu in ArcMap. Here, I have turned on snapping to vertices in both the existing polygons and the new one I’m drawing (the sketch). Now, when I hover close to a vertex, the mouse will jump right on top of it. Snapping makes it impossible for you to create a vertex in your new polygon that is close to a vertex in any nearby polygon. It forces all vertices to be in the exact same place, or far away.

Note: This will make creating very tiny polygons difficult. If you run into trouble with this you will need to change your snapping tolerance by selecting Options in the Editor dropdown.

Snapping is enough to fix the problem if you have just a few polygons or a lot of straight lines (like rectangular buildings). But in the case of this curvy soil map, you’re still going to have to zoom in and be careful to “hit” every vertex. It only offers a small help.

A much better way: Don’t digitize the polygons. Digitize the lines between the polygons.

Create an empty line file, and don’t worry about attributes yet. Zoom in to the scale you plan to digitize at, and don’t deviate from that zoom. Turn snapping on so that intersections meet. Then, just pan around and draw.

Now

  1. Create an empty polygon layer and add it to your map
  2. Start editing and make the polygon layer your target
  3. Select all the features in the line layer
  4. Turn on the Topology menu, and use the Construct Features tool. This will create a polygon from every distinct closed area.

Note: Snapping is important for the tool to recognize these areas as closed. If your result has holes, it is because you missed a spot.

Congratulations! You have just about halved the number of vertices you had to draw, and created truly contiguous polygons. Now, add your attribute fields. It’s a good idea to save the line file in case you need to go back and make changes later.

Tags: , ,