PyMySQL

The popular MySQL (available at http://dev.mysql.com/downloads) database is gradually evolving spatial functions. It has support for OGC geometries and a few spatial functions. It also has a pure Python API available in the PyMySQL library. The limited spatial functions use planar geometry and bounding rectangles as opposed to spherical geometry and shapes. The latest development release of MySQL contains some additional functions that improve this capability.

In the following example, we'll create a database in MySQL called spatial_db. Then, we'll add a table called PLACES with a geometry column. Next, we'll add two cities as point locations. And finally, we'll calculate the distance using MySQL's ST_Distance function and then convert ...

Get Learning Geospatial Analysis with Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.