GIT461 Final Exam Programming Project



April 19, 2014GIT461 Final Exam Programming ProjectDue Date: End of Scheduled Final Exam PeriodIntroductionFor this project you will produce a Python 2.7 (PythonWin or IDLE) program that can generate a text file (.txt) that contains the decimal degree longitude (x) and latitude (y) coordinates of the lat.-long. reference marks commonly found on a U.S. Geological Survey topographic map. For example, standard USGS 1:24,000 7.5 minute quadrangles contain a 4 x 4 grid of 2.5 minute reference marks. Typically these reference marks are used to georeference raster images scanned into a computer. The USGS publishes a variety of topographic maps that have a variable number of reference marks and spacing between reference marks. The below table summarizes these variations:Topo MapEast-West extentNorth-South extentSpacing1:24,000 (7.5 x 7.5 min.)7.5 minute7.5 minutes2.5 minutes (4 x 4)1:62,500 (15 x 15 min.)15 minute15 minutes5 minutes (4 x 4)1:100,000 (1 deg. X 30 min.)1 degree30 minutes7.5 minutes (8 x 4)1:250,000 (2 deg. X 1 deg.)2 degrees1 degree15 minutes (8 x 4)You program should be able to construct the above grids as a text file that can be imported easily into Excel. In fact, it should be versatile enough to construct any specified rectangular grid of reference points. The program should accept input on the command line, or prompt interactively for the line:Parameter 1: file name of output disk fileParameter 2: Longitude of southwest corner in (+/-)DDDMMSS formatParameter 3: Latitude of southwest grid corner in (+/-)DDMMSS formatParameter 4: Longitude of northeast corner in (+/-)DDDMMSS formatParameter 5: Latitude of northeast corner in (+/-)DDMMSS formatParameter 6: Longitude Spacing of grid in DDMMSS formatParameter 7: Latitude Spacing of grid in DDMMSS formatThe output file should consist of 3 columns separated by commas:Column 1: decimal degree longitude value (7 decimal places). Column 2: decimal degree latitude value (7 decimal places).Column 3: grid point countThe index number of the grid point counter should increase by column first then by row, starting with the SW corner. For example, for the 16 grid points on a standard 7.5 minute 1:24,000 quadrangle the SW corner would be “1”, the SE corner would be “4”, the NW corner would be “13”, and the NE corner would be “16”. The output file should be comma delimited for easy importation into Excel. The longitude and latitude coordinates in the output file should be in decimal degrees for compatibility with the ESRI ArcMap “Import XY Data” menu option. Note that the “File > Data > Import XY data” can directly read a text file that is comma delimited so you do not have to import the output file into Excel- you can directly import it into ArcMap with the “Import XY Data” menu option.If a “+” sign is not included for any longitude or latitude coordinate your program should be able to adjust and assume that the number is positive. The spacing number will not need a “+/-“ indicator (i.e. there is no such thing as a “negative” grid spacing). The below quadrangles can be downloaded to test your program: should set the ArcMap project to UTM NAD27 zone 16 before adding the above georeferenced quadrangles to the project. Use the “Add XY data…” to add your text file generated by your program. The version of ArcGIS (10.1) that we are using can add a comma-delimited text file directly so you don’t have to load the text file into Excel if you want to skip that step. Remember that when you add this file that the coordinates in the file are decimal degree “geographic” coordinates. Useful Programming FunctionsThe following are functions that will be useful for completing the lat-long grid programming project:len(string) : returns the length (no. of characters) in a string variable or expressionfloat(string): returns the floating point equivalent of the stringint(float number): returns the integer portion of a floating point numberround(float number): returns the integer result of rounding a floating point numberabs(number): returns the absolute value of the number (floating point or integer)str(number): returns the string equivalent of a number (floating point or integer)sys.argv[1]: returns the 1st parameter string on the command lineProgramming OutlineInitialize constants (output file name, length of longitude/latitude strings, end-of-line character, output file delimiter).Retrieve and store command line parameters (or prompt interactively for string):Alex City AL 1:24k: “c:/temp/grid.txt -0860000 +325230 -0855230 +330000 000230 000230”Montgomery AL 1:100k: “c:/temp/grid.txt -0870000 +320000 -0860000 +323000 000730 000730”Montgomery AL 1:250k: “c:/temp/grid.txt -0880000 +320000 -0860000 +330000 001500 001500”Note that in the above examples the input string must be enclosed in quotes if you prompt interactively with an “input” statement. Check latitude/Longitude strings for proper length and whether they have a “-“ sign (do this with a function because it is repetitive).Convert longitude/latitude values to decimal degree values (use functions).Open text file for output.Calculate number of rows and columns for calibration marks.Initialize counters for while loop.Construct a double while-loop to loop through all columns and rows.Calculate the decimal degree value of the longitude/latitude coordinate appropriate for the current row and column position.Write the decimal degree longitude, latitude, and current calibration mark count to output file.Close output file.Test your program using all 3 of the given USGS topographic maps. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download