Commit 37469311 authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Added 'out_srs' argument to get_data method of GisData.

git-svn-id: https://svn.seismo.oma.be/svn/seismo/mapping/layeredbasemap/trunk@7623 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent 8d1a419e
...@@ -17,6 +17,7 @@ except: ...@@ -17,6 +17,7 @@ except:
import numpy as np import numpy as np
import ogr import ogr
from mapping.geotools.coordtrans import WGS84
from .base import BasemapData from .base import BasemapData
from .point import PointData, MultiPointData from .point import PointData, MultiPointData
from .line import LineData, MultiLineData from .line import LineData, MultiLineData
...@@ -91,7 +92,7 @@ class GisData(BasemapData): ...@@ -91,7 +92,7 @@ class GisData(BasemapData):
return read_gis_file_attributes(self.filespec) return read_gis_file_attributes(self.filespec)
def get_data(self, point_value_colnames=None, line_value_colnames=None, def get_data(self, point_value_colnames=None, line_value_colnames=None,
polygon_value_colnames=None, layer_num=None): polygon_value_colnames=None, layer_num=None, out_srs=WGS84):
""" """
Read GIS records, transforming into LayeredBasemap data types Read GIS records, transforming into LayeredBasemap data types
...@@ -107,6 +108,11 @@ class GisData(BasemapData): ...@@ -107,6 +108,11 @@ class GisData(BasemapData):
:param layer_num: :param layer_num:
int, layer number to read int, layer number to read
(default: None) (default: None)
:param out_srs:
instance of :class:`ogr.SpatialReference`
spatial reference system into which coordinates will be transformed
If None, native spatial reference system will be used
(default: WGS84)
:return: :return:
(MultiPointData, MultiLineData, MultiPolygonData) tuple (MultiPointData, MultiLineData, MultiPolygonData) tuple
...@@ -160,7 +166,8 @@ class GisData(BasemapData): ...@@ -160,7 +166,8 @@ class GisData(BasemapData):
attribute_filter = None attribute_filter = None
for rec in read_gis_file(self.filespec, layer_num=layer_num, for rec in read_gis_file(self.filespec, layer_num=layer_num,
attribute_filter=attribute_filter, attribute_filter=attribute_filter,
region=self.region, verbose=self.verbose): region=self.region, out_srs=out_srs,
verbose=self.verbose):
selected = np.zeros(len(self.selection_dict.keys())) selected = np.zeros(len(self.selection_dict.keys()))
for i, (selection_colname, selection_value) in enumerate(self.selection_dict.items()): for i, (selection_colname, selection_value) in enumerate(self.selection_dict.items()):
if rec[selection_colname] == selection_value: if rec[selection_colname] == selection_value:
......
Markdown is supported
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