Working with geospatial databases using python
In this section, we will build on what we've learned so far by writing a short program to (i) create a geospatial database, (ii) import data from a shapefile, (iii) perform a spatial query on that data, and (iv) save the results in WKT format. We will write the same program using each of the three databases we have explored in this chapter, so that you can see the differences and issues involved with using each particular database.
Prerequisites
Before you can run these examples, you will need to do the following:
If you haven't already done so, follow the instructions given earlier in this chapter to install MySQL, PostGIS, and SpatiaLite onto your computer.
We will be working with the GSHHS shoreline dataset from Chapter 4, Sources of Geospatial Data. If you haven't already downloaded this dataset, you can download the shapefiles from:
Take a copy of the
l
(low-resolution) shapefiles from the GSHHS...