ArcPy - Split Polygon into Equal Parts (ArcGIS 10.x)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so once you download the split polygon files from the Google Drive these are the files and the tutorial video is inside the video tutorial folder let's see if we can not go to this folder within ArcGIS so in arcmap you can click on the catalog button in the toolbar and then the catalog window will open up then you can actually connect you can connect click on this and connect to the folder in your system I've already connected to my occupier folder inside a tutorial for that this is where I've downloaded a file if you click the plus button next to the toolbox the split by equal path tool box you see the split polygon script now if you don't see it is ok if you see it right click on the toolbox and go to properties right click on the script sorry now this script has a different file path for my machine than yours so on your machine you would have to go to source and click on the Browse button to go and pick the Python script that means the powerful change for you then you click on OK then you can actually run the tool now if you don't have this script tool so what delete it and show you what to do if you don't have this script tool so let me delete mine let's say I don't have it I don't have this script tool and this is usually on old versions of arcmap right click the toolbox go to add and click on script and this will allow you to attach a script to the toolbox so I can give it any name I want but the name shouldn't have a space so good code split polygon then the label can be anything you want I can ask actually have this space sprint polygon tool and if you go down you can store relative paths in case you move the two I'm going to click on next and then I'm going to browse for my script file so let's go to the same folder my tutorial for that day's script it's called ends are split equal parts does the Python script let's open it so now does the right path on this machine now we have to define the variables the script accepts four variables in the display name column you can enter any phrase you want so the first parameter is for the input shapefile so you say input input or input shapefile whatever name you want to call it and these are type for this is a feature layer so this in alphabetical order so go to feature layer the second parameter is a number of splits so the number of multiple subdivisions to make it clear and this is going to be a string remember we're setting this up one time string and then the default value I'm going to say if you'll be able to split something in ten by default the user can change it if they want the next parameter is the direction of splits remember any name describable name you can use is okay so this is direction of split and this is also a string parameter stream parameter and the directional split the default values will clean off self but we're going to modify their filters so we're going to use a value filter and give the user two options to split a program by the north-south direction or the west east direction okay so we can have a nice drop-down list for the user the next parameter is the output shapefile name and that will also be a string and the default name for that could be cut polygon so once I have the default name setup I can click on finish and that will complete the parameters for the two so now the tool we have the two here and going for it all you have to do is double-click the tool when you double click the tool to launch the tool for the various parameter set out one second let me go back and actually load my polygon in let me first load my polygon so in its same tutorial folder there is a sample polygon so let's use the first polygon I want to show you what the tool does if it recognizes polygons in the layers so let's double click the tool again sorry I'm doing this bit and still running the tools cogniser properties okay sorry I was looking somewhere else so now the tool you said the input and the input Schaefer is giving us a drop down here way to list all the polygons available then the number of subdivisions let me change the subdivision to fall then we can choose between north south or west east and then we can change the name of the output polygon if you wanted to with this I'm going to click on OK for the processing to begin so it's going to start dividing the polygon and exporting it as the name would we gave to the output polygon it's wait for that to finish so now the polygon has finished and it was exported it in the same folder as our input polygon so if we go to the folder we'll see it as a cut polygon further there they'll drag it to the map and there we have four equal parts the polygon has been split in four equal parts so this is how the two works so you can split any polygon you want into any number of parts if you have a problem reach out to me and I think there's a there's a text file within that folder there has my contact details so you can reach out to me if you also have an interesting project that you want us to look at more than willing so here are my details my whatsapp number and these are our two missions I like doing so you can reach out to me we can build more tools thank you very much
Info
Channel: Ebenezer Odoi
Views: 5,977
Rating: 4.8730159 out of 5
Keywords: ArcGIS, ArcPy, Subdivision
Id: ERm95MbqA3c
Channel Id: undefined
Length: 8min 10sec (490 seconds)
Published: Wed Sep 04 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.