[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Dec 15 14:33:39 EST 2010


changeset 06e8e2b8b4da in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=06e8e2b8b4da
summary: const methods should be const, Frank :)

changeset 341a03e5f68f in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=341a03e5f68f
summary: add option to reset the SRS to use the GeoTIFF key/WKT VLR combo

diffstat:

 apps/laskernel.cpp                     |  12 +++++++++++-
 include/liblas/lasspatialreference.hpp |   2 +-
 src/lasspatialreference.cpp            |   9 ++++++---
 3 files changed, 18 insertions(+), 5 deletions(-)

diffs (73 lines):

diff -r 4ea8d8659104 -r 341a03e5f68f apps/laskernel.cpp
--- a/apps/laskernel.cpp	Wed Dec 15 12:59:03 2010 -0600
+++ b/apps/laskernel.cpp	Wed Dec 15 13:33:30 2010 -0600
@@ -290,6 +290,7 @@
 
     transform_options.add_options()
         ("t_srs", po::value< string >(), "Coordinate system to reproject output LAS file to.  Use --a_srs or verify that your input LAS file has a coordinate system according to lasinfo")
+        ("add-wkt-srs", po::value<bool>()->zero_tokens(), "Reset the coordinate system of the input file to use both WKT and GeoTIFF VLR entries")
         ("point-translate", po::value<std::string>(), "An expression to translate the X, Y, Z values of the point. For example, converting Z units that are in meters to feet: --point-translate \"x*1.0 y*1.0 z*3.2808399\"")
         ("color-source", po::value<std::string>(), "A string to a GDAL-openable raster data source.  Use GDAL VRTs if you want to adjust the data source or set its coordinate system, etc. \n--color-source \"afile.tif\" ")
         ("color-source-bands", po::value< std::vector<boost::uint32_t> >()->multitoken(), "A list of three bands from the --color-source to assign to the R, G, B  values for the point \n--color-source-bands 1 2 3")
@@ -1201,7 +1202,16 @@
         vert_ref.SetVerticalCS(verticalCSType, citation, verticalDatum, verticalUnits);
         header.SetSRS(vert_ref);      
     }
-    
+    if (vm.count("add-wkt-srs")) 
+    {
+        // Reset the SRS using WKT, which will cause both GeoTIFF keys and OGC WKT 
+        // VLRs to be written to the file.
+        liblas::SpatialReference ref = header.GetSRS();
+        std::string wkt = ref.GetWKT();
+        ref.SetWKT(wkt);
+        header.SetSRS(ref);
+    }
+
     if (vm.count("t_srs")) 
     {
         liblas::SpatialReference in_ref;
diff -r 4ea8d8659104 -r 341a03e5f68f include/liblas/lasspatialreference.hpp
--- a/include/liblas/lasspatialreference.hpp	Wed Dec 15 12:59:03 2010 -0600
+++ b/include/liblas/lasspatialreference.hpp	Wed Dec 15 13:33:30 2010 -0600
@@ -177,7 +177,7 @@
     GTIF*       m_gtiff;
     ST_TIFF*    m_tiff;
 
-    mutable std::string m_wkt;
+    std::string m_wkt;
 
     std::vector<VariableRecord> m_vlrs;
     bool IsGeoVLR(VariableRecord const& vlr) const;
diff -r 4ea8d8659104 -r 341a03e5f68f src/lasspatialreference.cpp
--- a/src/lasspatialreference.cpp	Wed Dec 15 12:59:03 2010 -0600
+++ b/src/lasspatialreference.cpp	Wed Dec 15 13:33:30 2010 -0600
@@ -206,14 +206,17 @@
 
 {
     std::vector<VariableRecord>::iterator it;
-
+    std::string const liblas_id("liblas");
+    
     for (it = m_vlrs.begin(); it != m_vlrs.end(); )
     {
         VariableRecord const& vlr = *it;
         bool wipe = false;
 
         // for now we can assume all m_vlrs records are LASF_Projection.
-        if( eType == eOGRWKT && 2112 == vlr.GetRecordId() )
+        if( eType == eOGRWKT && 
+            2112 == vlr.GetRecordId() && 
+            liblas_id == vlr.GetUserId(true).c_str() )
             wipe = true;
 
         else if( eType == eGeoTIFF 
@@ -582,7 +585,7 @@
         }
 
         // save this for future calls, etc.
-        m_wkt = (const char *) pszWKT;
+        // m_wkt = std::string( pszWKT );
 
         // Older versions of GDAL lack StripVertical(), but should never
         // actually return COMPD_CS anyways.


More information about the Liblas-commits mailing list