Importing geocaching data
In the previous chapter, we generalized our import function by adding the capability to import more types of data supported by OGR.
Now, we will improve it again, make it handle some errors, make it compatible with our objects, and add two new capabilities. We will also convert the data in order to produce uniform objects.
To achieve our goals, we will analyze what kind of information is stored in the files that we want to open. We will use OGR to inspect the files and return some information that may help us with the data conversion.
First, let's alter our open_vector_file
function, allowing it to handle incorrect paths and filenames, which is a very a common error. Perform the following steps:
- Go to the
utils
folder and open thegeo_functions.py
file. - Add the following
import
statements at the beginning of the file:# coding=utf-8 import ogr import osr import gdal import os from pprint import pprint
- Now, edit the
open_vector_file
function via the following code...