datamade/plenario — pull request #20 by apanella (2014-07-17 21:58:06+00:00)
Title: Importing shapefiles into PostGIS (pure python)

### Import ESRI shapefiles to PostGIS database
#### Features
* Pure Python (no shp2pgsql)
* Shapefiles (and related files) are expected to be zipped archives, and not nested in sub-directories therein
* Coordinates are converted to WGS84 (ESPG:4326) so every table in the DB is consistent
* No integration with master table yet (and no centroid computation, but that's easy to do)

#### Location
* Added two functions in `wopr/models.py` that create a table schema from a shapefile
* Added two functions in `helpers.py` (didn't want to create another file) that carry out import and conversion

#### New dependencies
* shapely (geometries)
* fiona (shp I/O)
* pyproj (crs conversion)
* json (useful as intermediate representation)
* zipfile