Presentation is loading. Please wait.

Presentation is loading. Please wait.

Geography 375 Introduction to Python May 15, 2015

Similar presentations


Presentation on theme: "Geography 375 Introduction to Python May 15, 2015"— Presentation transcript:

1 Geography 375 Introduction to Python May 15, 2015
Merging a Million Tiny Polygons By Candy Williams Geography 375 Introduction to Python May 15, 2015

2 Merging a Million Tiny Polygons
Maps have been developed that show 19 different types of land use for counties in California. These maps are periodically updated using NAIP data to check for changes in land use. The first step is setting up geodatabases and datasets and photo checking the county to produce a changes layer. The second step is unioning the changes layer with the county land use layer. However, in some counties this also includes layers for Williamson Act properties, zoning, and others. The third step is unioning the updated county land use layer with a USDA soil survey layer. This process can cause a large amount of sub-acre polygons or slivers (polygons less than 1 acre that are caused by unioning the new land use layer with the soil layer.) In some cases there have been as many as 1,900 sub-acre polygons.

3 These polygons usually look like this.

4 When at work this is what we do now. Run a Query for sub acre polys:
“Shape_area”< > . Then zoom to each sub acre poly and merge according to “Merging sub-acre polygons” sheet (L and G go to each other first, then G, U, S, P; P and S go to each other first; S and U go to each other first; P, S, U go to G before X).

5 Right now all of these sub-acre polygons have to be manually merged to an adjacent polygon by following a 3 page criteria sheet. (e.g. if Class L is adjacent to Class G, it becomes G followed by Class U, S, or P and so on). This is also where mistakes are most likely to occur. For my project I would like to try to write a script that would merge these polygons automatically. The rules for merging these sub-acre polygons is very complicated. In the script that I am going to try I will just be concentrating on keeping it simple and only merge the L’s to the G’s and selecting the sub-acre polygons to a get the value (Let’s say “L” in this case). Then select all polygons touching it and merge it to the G. Non Rural Land Counties (39 counties) Note: never merge sub-acre polygons into D or W Polygons less than 1 acre (in order) Grazing Land (G) G to G, LP, L, U, S, P, X Local Potential (LP) LP to LP, L, G, S, P, U, X Farmland of Local Importance (L) L to L, LP, G, U, S, P, X Unique Farmland (U) U to U, S, P, L, G, LP, X Farmland of Statewide Importance (S) S to S, P, U, L, LP, G, X 6. Prime Farmland (P) P to P, S, U, L, LP, G, X 7. Other Land (X) X to X, G, LP, L, U, S, P

6 This is the script that I plan to try.
# Name #Date #Update 1) Import modules 2) Set the workspace 3) define common variables 4) Try: Use a search cursor to search for all sub acre polygons in the layer Put it in a for loop…… For each sub acre polygon (row) in sub acre polygon list (cursor):     Selected polygons = select layer by location (row, all polygons touching the boundary)     if sub acre polygon = L :         if selected polygons = G:             merge 5) Except: Error code here 6) list help 

7 The first thing I did was go to ESRI website on merging polygons:
This is what I got from the ESRI

8

9 Then I decided to try it on my own using map data from my work.

10 This script also had problems
This script also had problems. I think there were too many variables and too much data to analyze. This is also about the time that my computer and all of my data were stolen. A good time to start over (whether I wanted to or not……) I started looking into using simpler data. If I could make it work on a basic example, then I would have a basis for expanding the tool into my mapping projects. Instead of three pages of criteria (on slides above), I decided to use A, B, C, D and 1, 2, 3, 4.

11 This is a shot of what the new mxd looked like
The goal is to merge the small A and C triangles into the correct neighbor

12 After consulting the ESRI GeoNet chat room and running Nearest Neighbor, Sort, Update Cursor, Dissolve, and Append the mxd looks like this.

13 SUCCESS!!!!!!!!!!!!!!!! The script worked However, the process required turning the polygons into feature layers (3 were created). This process would probably take days to run through the geodatabases that I work on (10 layers and 1,900 polygons for a simple county) and the output tables would be huge. This is a start and may be developed by the department in the future.


Download ppt "Geography 375 Introduction to Python May 15, 2015"

Similar presentations


Ads by Google