Analyzing and creating GIS data using Python programming Josh Foery, JR Franks, Connor McMillan
Introduction In the digital age, modern companies and organizations have acquired vast quantities of geospatial data to suit their needs and operations. Frequently, however, these companies lack an efficient method of storing and referencing such a large amount of data. One efficient solution to this problem is computer programming. For this assignment, we used the Python suite (version 2.7) to create a simple program that allows a potential user to locate geospatial data within a large database. Our final program directs the user through four subsequent steps. The first step was to direct the user to specify a directory or geodatabase containing the geospatial data they are searching for. After the geodatabase is specified by the user, the next step of the program finds the extents of all the files within the specified directory or geodatabase. After the extents are found for each file, the user is prompted to create a new shapefile showing the extent of each file, and including information such as the name of the file and the file types as attributes. Lastly, after the new shapefile is created, and stored in the specified directory or geodatabase, the user is prompted to enter in a coordinate (in latitude and longitude), so that the program can return the names and types of all the files that cover the area specified by the user coordinates. Creating the program s source code required the utilization of multiple Python libraries. One of the main libraries used extensively was ArcPy, a library created to work seamlessly with the ArcGIS suite. Among its primary functions were to help the user locate a desired geodatabase, find the extents of all files within the specified geodatabase, and to create a new shapefile to be stored within the geodatabase. In addition to ArcPy, another critical component to the program was Tkinter. This library allows the program to create and use an interactive graphical user interface (GUI) that organizes each step of the program, allowing the user to perform each step in a user-friendly work environment. We also needed tkfiledialog, which allows the user to open or save a new file to a directory or geodatabase; this was a crucial step in the program that allows the user to save their new shapefile to their geodatabase or directory. An additional module used in the program is sys, allowing system-specific parameters and functions to be accessed by the user for use in the program. We were unsuccessful in integrating object
oriented to create our GUI. However, object oriented programming was added to the program to organize and store spatial data while the program was running. Flow Chart of Program with GUI Screenshot
Methodology Image 1: The code for steps 1 and 2, including the code for the GUI as well as the results
Image 2: The code for step 3, including the code for the GUI and the output window
Image 3: The code for step 4, the GUI as well as the program output (shapefile extents)
Conclusion Ultimately, our output source code successfully performs each initial task that we sought to achieve, making it a viable option for actual use by companies and organizations. This code allows an individual to 1) select their own directory or geodatabase, 2) determine the extents of each file, 3) create a new ArcGIS shapefile, and 4) query this new shapefile to determine which existing files cover the area of the output data. Some improvements that could be made in our program include 1) improving functionality within the GUI, 2) creating a loop option at the end of the program (providing the option to create reference and create additional data), 3) expanding the program s capabilities to include points and lines as well as polygons, and 4) adding additional object oriented programming within the GUI. Finally, this project taught us how to integrate several Python functions and libraries into one master code that could potentially serve as a primary asset to companies and organizations working with geospatial data.
Appendix Provided below is a copy of our source code: