Write a Python script that downloads data from a text-based web service. This can be an XML, CSV, or other text-based service. I prefer you access a formal "REST" based service but you can also use a file that is on the Internet (i.e. a KML, CSV, or HTML file). The data needs to include some spatial data and some a-spatial data (i.e. x,y coordinates and an attribute). There should be at least four features in the data.
Added note: there are two ways to complete this. One is with a single web service request that provides multiple features, such as a KML file. The other is to write a script that downloads multiple files from different locations, such as the USGS gage station web service. In this case, the response does not need to include spatial data if your script specifies spatial data.
Write a script that extracts the spatial data, with at least one attribute, from the file you downloaded above. Then, write the parsed data into a CSV file that can be loaded into a GIS application. The script should be able to extract all the data from a file or files (i.e. put it in a while loop).
Place your code into a function where you pass in the input (original XML file) file path and the output (CSV file) file path to save the file to.
Turn in two Python code files:
Add the scripts to a Zip file with any other data that is needed to run the scripts. Have your scripts use the "C:/Temp" folder for the files that are downloaded by your scripts and the files your scripts write out.
Make sure you've placed try/except blocks around each of your main sections of code.
© Copyright 2018 HSU - All rights reserved.