This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapefile | |
import pngcanvas | |
# Open shapefile with Python Shapefile Library | |
shapefile_name = 'REPLACE_WITH_SHAPEFILE_NAME' # e.g. england_oa_2001 | |
r = shapefile.Reader(shapefile_name) | |
# Determine bounding box x and y distances and then calculate an xyratio | |
# that can be used to determine the size of the generated PNG file. A xyratio | |
# of greater than one means that PNG is to be a landscape type image whereas |