Commit 42f4ea69 authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Added 'region' and 'verbose' properties to GisData.

Modified get_data method of GisData to take into account 'region' property, and completed docstring.

git-svn-id: 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent 12246465
......@@ -58,10 +58,17 @@ class GisData(BasemapData):
bool, whether or not to invert the selection criteria in
(default: False)
:param region:
(west, east, south, north) tuple in geographic coordinates,
defining rectangular spatial filter
(default: None)
:param verbose:
bool, whether or not :meth:`get_data` should be verbose
(default: False)
def __init__(self, filespec, label_colname=None, selection_dict=None,
joined_attributes={}, style_params={}, convert_closed_lines=True,
invert_selection=False, region=None, verbose=False):
self.filespec = filespec
self.label_colname = label_colname
self.selection_dict = selection_dict or {}
......@@ -69,6 +76,8 @@ class GisData(BasemapData):
self.style_params = style_params or {}
self.convert_closed_lines = convert_closed_lines
self.invert_selection = invert_selection
self.region = region
def get_attributes(self):
......@@ -95,6 +104,9 @@ class GisData(BasemapData):
:param polygon_value_colnames:
list of strings, names of columns to read for polygon data
(default: None, will read all available columns)
:param layer_num:
int, layer number to read
(default: None)
(MultiPointData, MultiLineData, MultiPolygonData) tuple
......@@ -147,7 +159,8 @@ class GisData(BasemapData):
attribute_filter = None
for rec in read_gis_file(self.filespec, layer_num=layer_num,
region=self.region, verbose=self.verbose):
selected = np.zeros(len(self.selection_dict.keys()))
for i, (selection_colname, selection_value) in enumerate(self.selection_dict.items()):
if rec[selection_colname] == selection_value:
......@@ -242,6 +255,7 @@ class GisData(BasemapData):
point_data.values[attrib_name] = [value_dict.get(key_val, default) for key_val in point_data.values[key]]
line_data.values[attrib_name] = [value_dict.get(key_val, default) for key_val in line_data.values[key]]
polygon_data.values[attrib_name] = [value_dict.get(key_val, default) for key_val in polygon_data.values[key]]
return (point_data, line_data, polygon_data)
def export(self, format, out_filespec):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment