GIS Python: Count shape files and Select by Location (2 Real world ArcPy examples)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video I will show you how to start scripting in Jes with Python and first of all we should download all necessary data from internet and in this example I will use natural air data calm and this is the site where I download all necessary shape files in this example I will use for example worth a airport just download it and I'm looking for I'm looking for countries yet countries and download the same directory in my computer okay so extracted into the separate folders ok and for checking purpose just connect our GIS project to this directory and add the data countries is looking perfect and airports is also looking perfect now we can start to work as you can see we have a big attribution table for airports which we have a location code named Wikipedia link we can see more information and for countries is almost the same it's a names of countries so type and so on ok step number two is our dengue scripting for scripting for scripting we use a pycharm framework I think the best framework for scripting in jes by Python it is a free version of our PI of PyCharm and ok we just download to the same directory and install it it's not so difficult okay and I think you can run it immediately you're not important settings because we don't have any settings before except to the conditions and run it okay this is not so important just press ok and create a new folder great okay step number three this is example to print it out all shapefiles that stores in our directory for this is better to put all our save files into the one folder like this and delete these separate folders that we created before okay run arcmap again a data entry the same like you'd like we do before just connect to project folder and add data from this directory okay we now we have all shape files into the one in one folder is a countries and airport into one folder okay this is a chest like symbolic for better understanding what there is what and run by term again okay now when we have to find the structure of our project we can to create a new Python script just right Mouse and new Python script they named it GIS script David not sorry no save it and before writing we should set the check that our Python is under GIS directory because only this bison has our Pi model so import this model import our PI and save it and run for checking as you can see it is an exit code is zero that means that we have no any errors and L PI model is working the first step for this example is to set the environment our PI dot and not workspace and means environment and here we should define the real directory to our folder so our project folder it's the data because this folders storage our all shapefiles airport and countries so we define future list variable that will save our list of shape files and for this we use a list future classes method and just print it out you'll see how look like in very simple way just like write them shrink for understanding chief GIS files that we found and put future lists save it and run it ok and now you can see a true shape file that we we have in our project directory is countries and airports it is here its countries and airports ok it's working so example number two is selected by location okay for this we create a new separate Python script it's select by location and do the same import egg by art by model at the beginning and define some variables that Airport is one shapefile and countries is a different shape file for this we use a read method yes mean error char and just copy a real director real rail address to the shape file it's a data polar and tail pod shape file just paste okay and do the same with countries it is our input data for the our project ok countries we did it and in this example we should define our output because the result of this script will be a new shapefile for airport that is inside a specific country so the out path is output folder okay the next what we do is to make future class may make future layer management it is a specific function to find for example our airports to specific object it is a point layer and do the same with the countries we define that countries is like a specific object is country's layer and [Music] for countries we should define a specific country that we should to focus on and I mean we should define a not city name like here click here but we should define a weight loss what is work loss matrix of clarity management has some different parameters that that should be input it is a weight loss workspace will feel sinful and what we must define is weight loss weight loss can should can be default defined in different ways we choose we choose a triple quad like this triple walk and instead of city name we replace it by our specific field name where is all countries names it's field name is name just write it name and for example I choose a example Mexico Mexico country that means I will choose all airports only within Mexico Oregon ok and what we do more is to implementing selecting by location regarding to the point layer and country layer that we defined before ok for this you select a location function we can see more information in official GIS desktop site Center as you can see we have a new click app to find in layer parameter that could be overlap type select feature and so on and also understand in this example we should use within overlap type because we will select all airports inside specific polygons because all airports should be selected should we select from a specific polygon that's right point layer is the first parameter the second parameter is overlap type it is different just paste it to the script within and we take focusing on countries layer it's Mexico and the last function that we use is feature class feature class conversion it is a function that will create a new shape files from our selection the first parameter is our point layer and out pad so and the last parameter is the name of our result of shape files with airports in Mexico okay now we can check how it's working so I put a Python script on the right and output directory on the left and you will see in real time house working I saved I run the script and as you can see the script created a new shapefile that shows the storage all airports in Mexico polygons is and you can see it here a zoom in for Beth and standig I make it bigger and this is our our result all airports in specific country polygon and I think the idea is very clear thank you for watching and don't forget to subscribe me bye bye
Info
Channel: Data Science Garage
Views: 28,435
Rating: 4.8488889 out of 5
Keywords: GIS Python for beginner, arcpy gis module, arcpy python module, gis python examples, gis python example, pycharm python framework, scripting pycharm, download pycharm, arcpy begineer, where clause gis, select by location gis, select by location python, select by location arcpy, makefeaturelayer python, make feature layer gis, get list shape files, get shape file list python, arcpy example, start using arcpy
Id: QMbSbvNBPM8
Channel Id: undefined
Length: 13min 11sec (791 seconds)
Published: Mon Jun 12 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.