-
Book Overview & Buying
-
Table Of Contents
Python Geospatial Development - Second Edition - Second Edition
By :
Next, we need to implement the ability to export a shapefile. The process of exporting a shapefile is basically the reverse of the "import" logic, and involves the following steps:
Create an OGR shapefile to receive the exported data.
Save the features into the shapefile.
Save the attributes into the shapefile.
Compress the shapefile into a ZIP archive.
Delete our temporary files.
Send the ZIP file back to the user's web browser.
All this work will take place in the shapefileIO application, with help from some utils.py functions. Before we begin, let's create an exporter module to handle the exporting process. Go to the shapefileIO directory, and create a new module named exporter.py. Initially, we're just going to add a dummy function to this module:
def export_data(shapefile):
return "More to come..."This function will take a desired Shapefile object, and return an HttpResponse that can be returned by the view function. This HttpResponse object will send the contents of...
Change the font size
Change margin width
Change background colour