First, create a Python script with a function that converts a US formatted date (MM/DD/YYYY) into a nice, human-readable, form like: 31st of October, 2011. Call the function with at least 3 dates and print them out to make sure it works. Put this function at just below the file header in your file before any other code that might call it.
Tip: A pre-defined list is an easy and fast method for finding the text string that matches a given month's name (i.e. matching "1" to January).
One of the most common tasks that programmers will be asked to tackle is to take an existing file and either reformat it, fix a problem in it, or convert the values in it to another format. This assignment will give you the chance to do this for yourself and put together a number of concepts you've learned so far.
The U.S. Board on Geographic Names contains a very large database of the names of cities, streams, valleys, and other physical features on the earth. You've been asked to create a file that can be loaded into ArcGIS. The data in the columns of the table should contain values that are nicely readable so we can use them as symbology in ArcGIS.
Download one of the files from their website (feel free to use California if desired) and convert it into a text file that has the following columns (in any order).
You can filter the contents of the files to just output one feature class if desired.
To complete this task, you'll want to first read in the file on line at a time. Then, check the "delimiter" for the text in each line. Use the delimiter to "split" up the line into "tokens". Then, select the tokens you want to include in your output file. Write out the file based on the columns above. Finally, call any required format conversion functions for those columns.
The overall structure of a file of this complexity is important for readability. Your file should have the following sections:
Remember to add a header for each function and other appropriate comments.
Add the following attributes to the file:
Note: ArcGIS cannot display the degree symbol and is not happy with the double quote symbol either. What would be a good approach to format geographic coordinates as attributes?
Convert the DMS coordinates from the GNIS data and compare the values with the DD coordinates in the same row to see how close they are. Add the difference as a column to the file.
© Copyright 2018 HSU - All rights reserved.