[Liblas-commits] hg: clear WKT in SetVerticalCS so it is
regenerated in ResetVLRs
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Jan 27 10:21:53 EST 2011
details: http://hg.liblas.orghg/rev/95b83d179459
changeset: 2827:95b83d179459
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 27 09:20:01 2011 -0600
description:
clear WKT in SetVerticalCS so it is regenerated in ResetVLRs
Subject: hg: put transforms on the writer
details: http://hg.liblas.orghg/rev/2e3959d6cf15
changeset: 2828:2e3959d6cf15
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 27 09:20:12 2011 -0600
description:
put transforms on the writer
Subject: hg: update to reflect C API reprojection changes
details: http://hg.liblas.orghg/rev/f71d57615147
changeset: 2829:f71d57615147
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 27 09:21:41 2011 -0600
description:
update to reflect C API reprojection changes
diffstat:
python/liblas/core.py | 9 +++++++++
python/liblas/point.py | 7 +++++++
python/tests/SRS-GDAL.txt | 9 +++++++--
src/c_api.cpp | 12 ++++++++++--
src/spatialreference.cpp | 5 +++--
5 files changed, 36 insertions(+), 6 deletions(-)
diffs (120 lines):
diff -r 941c259f8c63 -r f71d57615147 python/liblas/core.py
--- a/python/liblas/core.py Wed Jan 26 13:03:31 2011 -0600
+++ b/python/liblas/core.py Thu Jan 27 09:21:41 2011 -0600
@@ -674,6 +674,15 @@
las.LASPoint_SetColor.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
las.LASPoint_SetColor.errcheck = check_return
+las.LASPoint_SetHeader.restype = None
+las.LASPoint_SetHeader.argtypes = [ctypes.c_void_p,
+ ctypes.c_void_p]
+las.LASPoint_SetHeader.errcheck = check_void_done
+
+las.LASPoint_GetHeader.restype = ctypes.c_void_p
+las.LASPoint_GetHeader.argtypes = [ctypes.c_void_p]
+las.LASPoint_GetHeader.errcheck = check_void
+
las.LASPoint_Destroy.argtypes = [ctypes.c_void_p]
las.LASPoint_Destroy.errcheck = check_void_done
las.LASPoint_Destroy.restype = None
diff -r 941c259f8c63 -r f71d57615147 python/liblas/point.py
--- a/python/liblas/point.py Wed Jan 26 13:03:31 2011 -0600
+++ b/python/liblas/point.py Thu Jan 27 09:21:41 2011 -0600
@@ -48,6 +48,7 @@
import color
import ctypes
+import header
class Point(object):
def __init__(self, owned=True, handle=None, copy=False):
@@ -468,6 +469,12 @@
"""
color = property(get_color, set_color, None, doc)
+ def get_header(self):
+ return header.Header(handle=core.las.LASPoint_GetHeader(self.handle))
+
+ def set_header(self, value):
+ return core.las.LASPoint_SetHeader(self.handle, value.handle)
+ header = property(get_header, set_header, None, None)
# def descale(self, header):
# """Descales the point with a given :obj:`liblas.header.Header` instance
#
diff -r 941c259f8c63 -r f71d57615147 python/tests/SRS-GDAL.txt
--- a/python/tests/SRS-GDAL.txt Wed Jan 26 13:03:31 2011 -0600
+++ b/python/tests/SRS-GDAL.txt Thu Jan 27 09:21:41 2011 -0600
@@ -72,7 +72,7 @@
# >>> utm_header.scale = [0.000001,0.000001,0.000001]
>>> utm_header.srs = s_utm
- >>> dd_header.scale = [0.000001,0.000001,0.000001]
+# >>> dd_header.scale = [0.000001,0.000001,0.000001]
>>> dd_header.srs = s_dd
>>> f = file.File('../test/data/1.2_3.las',mode='r', header = utm_header)
@@ -100,6 +100,11 @@
>>> f_project = file.File('junk_srs_project.las',mode='w',header=dd_header)
+
+ >>> p.header = dd_header
+ >>> p.x, p.y
+ (-93.350000000000009, 41.579999999999998)
+
>>> dd_header.srs.proj4
'+proj=longlat +datum=WGS84 +no_defs '
>>> f_project.write(p);f_project.write(p);f_project.write(p)
@@ -107,7 +112,7 @@
>>> del f_project
>>> f3 = file.File('junk_srs_project.las')
>>> f3.header.data_offset
- 477L
+ 789L
>>> s_utm = srs.SRS()
>>> s_utm.wkt = utm_wkt
diff -r 941c259f8c63 -r f71d57615147 src/c_api.cpp
--- a/src/c_api.cpp Wed Jan 26 13:03:31 2011 -0600
+++ b/src/c_api.cpp Thu Jan 27 09:21:41 2011 -0600
@@ -441,7 +441,11 @@
transforms.end());
liblas::TransformPtr srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, *out_ref, liblas::HeaderPtr(new liblas::Header(h))));
- transforms.insert(transforms.begin(), srs_transform);
+ if (transforms.size())
+ transforms.insert(transforms.begin(), srs_transform);
+ else
+ transforms.push_back(srs_transform);
+ reader->SetTransforms(transforms);
// ((liblas::Reader*) hReader)->SetOutputSRS(*((liblas::SpatialReference*)hSRS));
}
@@ -1729,7 +1733,11 @@
transforms.end());
liblas::TransformPtr srs_transform = liblas::TransformPtr(new liblas::ReprojectionTransform(in_ref, *out_ref, liblas::HeaderPtr(new liblas::Header(h))));
- transforms.insert(transforms.begin(), srs_transform);
+ if (transforms.size())
+ transforms.insert(transforms.begin(), srs_transform);
+ else
+ transforms.push_back(srs_transform);
+ writer->SetTransforms(transforms);
}
catch (std::exception const& e) {
LASError_PushError(LE_Failure, e.what(), "LASWriter_SetOutputSRS");
diff -r 941c259f8c63 -r f71d57615147 src/spatialreference.cpp
--- a/src/spatialreference.cpp Wed Jan 26 13:03:31 2011 -0600
+++ b/src/spatialreference.cpp Thu Jan 27 09:21:41 2011 -0600
@@ -714,8 +714,9 @@
throw std::runtime_error("The geotiff keys could not be written");
}
- // TODO: Should we clear WKT so it gets regenerated?
-
+ // Clear WKT so it gets regenerated
+ m_wkt = std::string("");
+
ResetVLRs();
#else
boost::ignore_unused_variable_warning(citation);
More information about the Liblas-commits
mailing list