Skip to content

Commit

Permalink
# This is a combination of 5 commits.
Browse files Browse the repository at this point in the history
# The first commit's message is:
Implement readers.tindex

# This is the 2nd commit message:

wip readers.tindex working

# This is the 3rd commit message:

example for readers.tindex

# This is the 4th commit message:

use readers.tindex if file extension is .tindex

# This is the 5th commit message:

support assignment --a_srs to override any/all SRS info from the file itself
  • Loading branch information
hobu committed Nov 22, 2015
1 parent dceb3f2 commit 003abd3
Show file tree
Hide file tree
Showing 9 changed files with 571 additions and 6 deletions.
27 changes: 25 additions & 2 deletions include/pdal/GDALUtils.hpp
Expand Up @@ -75,7 +75,18 @@ class SpatialRef
}

void setFromLayer(OGRLayerH layer)
{ newRef(OSRClone(OGR_L_GetSpatialRef(layer))); }
{
if (layer)
{
OGRSpatialReferenceH s = OGR_L_GetSpatialRef(layer);
if (s)
{
OGRSpatialReferenceH clone = OSRClone(s);
newRef(clone);
}

}
}
operator bool () const
{ return m_ref.get() != NULL; }
OGRSpatialReferenceH get() const
Expand Down Expand Up @@ -114,7 +125,14 @@ class Geometry
OGRGeometryH geom;

char *p_wkt = const_cast<char *>(wkt.data());
OGR_G_CreateFromWkt(&p_wkt, srs.get(), &geom);
OGRSpatialReferenceH ref = srs.get();
if (srs.empty())
{
ref = NULL;
}
OGRErr err = OGR_G_CreateFromWkt(&p_wkt, ref, &geom);
if (err != OGRERR_NONE)
throw pdal::pdal_error("unable to construct OGR geometry from wkt!");
newRef(geom);
}

Expand All @@ -135,6 +153,11 @@ class Geometry
return std::string(p_wkt);
}

void setFromGeometry(OGRGeometryH geom)
{
if (geom)
newRef(OGR_G_Clone(geom));
}

private:
void newRef(void *v)
Expand Down
1 change: 1 addition & 0 deletions io/CMakeLists.txt
Expand Up @@ -11,5 +11,6 @@ add_subdirectory(qfit)
add_subdirectory(sbet)
add_subdirectory(text)
add_subdirectory(terrasolid)
add_subdirectory(tindex)

set(PDAL_TARGET_OBJECTS ${PDAL_TARGET_OBJECTS} PARENT_SCOPE)
10 changes: 10 additions & 0 deletions io/tindex/CMakeLists.txt
@@ -0,0 +1,10 @@
set(src
TIndexReader.cpp
)

set(inc
TIndexReader.hpp
)

PDAL_ADD_DRIVER(reader tindex "${src}" "${inc}" objs)
set(PDAL_TARGET_OBJECTS ${PDAL_TARGET_OBJECTS} ${objs} PARENT_SCOPE)

0 comments on commit 003abd3

Please sign in to comment.