Posts

Showing posts with the label GIS Programming

GIS 5103 Module 6

Image
Brief Overview of Module 6 This module involves creating a .txt file in Python, identifying vertices in a .shp file, and transferring selected information from the .shp file into the newly created .txt file.  In this flowchart a basic process is summarized for the creation of the script. 1)The input workspace environment is defined, along with the output, and the file that the data will be taken from, which was a shapefile of rivers.  2)A textfile is created next using the open() command, and is set to enable the file to allow writing.  3) A search cursor is created within the rivers shapefile to identify the object ID, the Shape, and the Name.  4) A vertex ID created unique for each vertex within the object next. This is done using a nested for loop, in which actions are performed for each row. First, the vertex ID is defined starting with 1, then the XY data is obtained using the getPart function.  5) This information is then written to the te...

GIS 5103 - Module 5

Image
Overview: In this module, a new file geodatabase is created in Python, files from one folder are copied into the gdb, a selection from one file is made using an SQL query format, and the output is used to inform a dictionary. The dictionary ultimately displays all New Mexico cities which are county seats, and their populations. Process:  To begin this module, I had already completed the exercises, which was very helpful. It provided a very clear direction for where to go with the different sections in this module. 1) Input arcpy and set the input and output data paths, and ensure they are able to be overwritten. This includes creating an output to a new file gdb. 2) Define a list of feature classes in the environment, and copy them to the new gdb. 3) Create a search cursor to search within the FEATURE column and select out all rows which contain the value of County Seat. 4) Create a dictionary that defines the key as the city name, and the value as the population, for thos...

GIS 5103 - Module 4

Image
In this module, I was tasked with creating a script in Spyder that will take one existing shapefiles of hospitals, and will perform the following in sequential order: 1) Add XY data, meaning a column for X and a column for Y, and populate them using information in the original point file which lacked XY data. 2) Create a buffer of 1000 meters around the hospitals. 3) Dissolve overlapping buffers into one feature. The script below shows successful completion of these steps in the Spyder console. I had some issues running the script at first. Due to syntax errors, I was struggling to get the XY step to run. I thought the issue was due to corrupted file paths, and spent some time trying to debug in the wrong area. The issue was simple to fix as it was just some extra quotations marks, but it took some looking to catch.  Please see my process summary for more information on my process.  1.       I was getting an error that my file path ...

GIS 5103 - Module 2

Image
Introduction and Brief Overview of Module 2 In this module, 4 scripts are written, focusing on while loops and lists. The first script pulls my last name from a string of my name, making my name into a list, and then pulling my last name from the list. The second script runs a dice game in which players 'roll' dice and the outcome is a random name constrained by the number of letters in their first name. The third script runs a list of 20 random numbers between 0 and 10. And the last script identifies if there is an unlucky number in that list, and if so, removes it. My experience with this module and lab Throughout the process of developing and debugging these, I ran into some error messages that largely pointed me in the direction of where in the code my error was, either by highlighting the line with the error and giving a brief statement, or by running the code and getting a more detailed statement in the output as to what word or what error was occurring. This helped...

GIS 5103 - Module 3

Image
Debugging:   In this module, three scripts are provided with pre-existing errors. I corrected the errors using Spyder's debugging tools, correcting syntax, and using try-except statements.  Issues and Notes: In this modules, I encountered some errors I had to research a bit to learn how to deal with them and what they mean, I encountered some formatting issues that had to be dealt with before corrected code would work, and I had to use logical thinking to understand first what the process was attempting to do, how it was doing it, and where adjustments or additions were needed to make the code work.  Part 1: Correcting errors In this part, the code is intended to print the field names in a shapefile. The code contains multiple syntax errors. I was able to identify the errors and correct them. The steps are as follows: 1) Look at code, lines with errors will be indicated on the right with note on what the error is. 2) I could catch these errors just by l...

GIS 5103 - Module 1

Image
Module 1 is an intro module, covering some basic concepts needed to open, structure, and run a Python script in Spyder for use in ArcGIS Pro. Being the first time I am ever using Python, this information is very useful for me to know where to start, and to see a script run and the result of it.     In this image, the Python script automatically inserted 8 folders for the 8 modules of the course, as well as 3 subfolders within each module folder. Follow these hyperlinks to see the images in more detail.  GISProgramming Folder    Module1 Folder Process Summary: 1) Open Spyder through command prompt           -Identify where command prompt is. I struggled a little bit with this just finding the command               prompt, as it does not appear in a search and I don't usually go into the subfolders of            programs. It is located under the ArcGIS Pro f...

GIS 6005 - Lab 6 - Relationship Between Obesity & Inactivity, US Counties

Image
This is an example of a bivariate choropleth map. There are two variables being shown here using a color scheme that fades across two color spectrums. The variables are percent obesity and percent inactivity, by US County. To prepare data for mapping in a bivariate map, you must be able to show a relationship between the variables. To do this in ArcGIS Pro at this time, there is a bit of manual work to be done, so you can follow the steps below to prepare your data set. 1. Establish your class breaks for each of your two variables. Decide what type of breaks you will use (natural, quantile, equal interval, etc.). Establish class breaks through either manual calculations, or by setting your map display and recording the class breaks that are automatically set. 2. Add three columns in your data set; a column to flag which class your values for the first variable will be in, a column to flag which class your values for your second variable will be in, and a column that concatenates...

GIS 6005 - Lab 6 - Trend in Employment by Number of Jobs Gained or Lost, US States

Image
The map symbol sizes represent the difference in jobs, and are categorized to represent the same number of jobs for both gains and losses. The orange symbol indicates that that state lost jobs and the blue indicates that it gained jobs. The symbols are adjusted with Flannery's correction, making the difference between symbol size most apparent. We can see that the largest change in employment were with jobs gained, and that this occurred largely in Texas, California, and New York. This symbology provides an easy to understand visual of the change in employment by number across US states. This is not normalized however, and represent numbers of jobs, not percent employed or unemployed.

GIS 6005 - Lab 5 - The Relationship between Premature Death & Child Poverty

Image
My variables are child poverty as a percent of child population and premature death. Premature death is measured as a rate of potential years of life lost (YPLL) per 100,000 people. I am relating these variables as a means of generalizing social determinants of health under poverty, as it tends to be a commonality across persons who have experienced a number of adverse childhood experiences (ACEs). As we know, your health impacts your life span, and this is true for physical health and socio-emotional well-being. That is to say, your mothers ability to find childcare is as intrinsically linked to your likelihood of developing cancer later in life as smoking is. For my map, I am using a purple color scheme across all of my map elements. It is a dark, but relaxing color and is also associated with cancer, mental health, and suicide awareness. My maps are sharing a color ramp, and the color ramp is also reflected on my scatter plot. The legend for the two maps is joined into one si...

GIS 6005 Lab 4 - Percent Population Change of Colorado Counties, 2010 to 2014

Image
Above is a map of population change in Colorado from 2010 to 2014 by counties. I used a 6 class color palette with natural breaks, with a break at 0. Above zero are 3 classes of positive values to represent degrees in population increase, shown in greens. Below zero are three classes to represent population decline, shown in reds. The color palette was generated in Color Brewer. The legend shows the breaks in more of a sentence structure, with class breaks described in the format '_% to _%'. This way, it is clear what the symbols represent, both in terms of the span of values per color and the fact that we are looking at percents and not numbers. There is a callout extending from the legend stating what the states population change was.

GIS 6005 Lab 4 - Color Ramps

Image
The Color Brew ramp roughly shares the same class intervals as the adjusted progression ramp, with higher steps between G and B values and lower steps between R values. The intervals between classes on the Color Brewer ramp are not equal intervals though, while the ramps I selected in ArcGIS were exact intervals. The values calculated above for the class intervals are averages. Additionally, the values in Color Brewer don’t uniformly increase as you move to a lighter shade. For example, the R values increase from 185 to 223, then decrease to 201, the rise again to 241. You can also see visually that the saturation appears to change throughout the palette in a nonuniform way, such as the second color appearing very bright and intense compared to the other colors in the palette.

GIS 6005 Module 3 - Terrain of Yellowstone National Park

Image
This is  map of Yellowstone National Park with traditional hillshade and a hand-picked thematic color scheme to represent tree cover type. The colors I selected were shades of greens and browns to represent tree types, grey for non-forested areas, and blue for water. These are all very natural colors, except for grey, which was selected to divert the eye from this area as it does not contain pertinent information to one interested in specific tree type.  A traditional hillshade was selected instead of a multidirectional hillshade because this option puts a heavy emphasis on shaded areas, making relief more detectable at a small scale. A heavy transparency (of 37% for forested areas and more for non-forested and water) was placed on the foliage type layer to make the terrain features more visible through the color.

GIS6005 - Module 2 - Nunavut Territory of Canada

Image
Nunavut Territory of Canada I selected the territory of Nunavut. This area is fairly mid-sized (bigger than a state/city but smaller than a continent), which spans predominantly North and South, and is made up of many small islands that stretch up almost to the pole.  Because this is a midlatitude region that doesn’t quite reach a pole, a conic projection is a good choice as it is pretty versatile and can be adjusted to work for different areas. Canada Albers Equal Area Conic is specifically made for regions in Canada, which the standard parallels adjusted for the region. Because this region is so far North, I wanted to ensure that the area was not distorted and stretched as is the case for many other projections. This projection will preserve the area and will not greatly distort the shape. Nunavut did not fit well within a UTM or a state plane so those options were not available. While the Lambert Conformal conic, another widely used conic projection that is conformal, was a...

GIS6005 - Module 1 San Francisco Bay Area, Point of Interest

Image
San Francisco Bay Area, Points of Interest Because this is a general reference map for public use, I opted for many preset font options available in ArcGIS Pro. This included default text options for water, sized appropriately for the significance of the body of water. The labels were placed on a bend to mimic the flow of the water and the shape of the shorelines. For land formations or parks, another preset font option was chose, the land formation option. Again, the text was placed on a curve to mimic the curve of the land feature being labeled. The font type for features that are populated places was also a font preset, the Populated Places option. Some resizing was done to make the label for San Francisco stand out from the other labels. The label for the bridge was also labeled using the populated places option, but sized smaller to fit along the narrow bridge. A couple callouts were used where the available land area was coastal and also too small to hold a label. The use o...

GIS6005 - Module 1 Recreation in Austin, TX

Recreation in Austin, TX An explanation of how the 5 map design principles were applied in the making of this map: Visual contrast was considered in my design in terms of colors selected for the map symbols and the effects added to them. The background was a pale color while the symbols are brighter and more vibrant to draw the eye. The push pins needed some outlines to make these elements standout from each other. Legibility was considered in the text as well as the actual map. I made the map large so no small areas or clusters would be difficult to distinguish at all. The text size was all made well above the recommended minimum viewing criteria or 4 points for a printed map. Microsoft Sans Serif was used for all text because it is plain and easy to read. Keeping all text the same provided uniformity and no text was small enough to warrant serifs. Figure-ground orientation was not a huge issue here because there was no shading or any other complex elements that might co...