Polygon Polygon::transform(const SpatialReference& ref) const { if (m_srs.empty()) throw pdal_error("Polygon::transform failed due to m_srs being empty"); if (ref.empty()) throw pdal_error("Polygon::transform failed due to ref being empty"); gdal::SpatialRef fromRef(m_srs.getWKT()); gdal::SpatialRef toRef(ref.getWKT()); gdal::Geometry geom(wkt(12, true), fromRef); geom.transform(toRef); return Polygon(geom.wkt(), ref, m_ctx); }
std::string transformWkt(std::string wkt, const SpatialReference& from, const SpatialReference& to) { //ABELL - Should this throw? Return empty string? if (from.empty() || to.empty()) return wkt; gdal::SpatialRef fromRef(from.getWKT()); gdal::SpatialRef toRef(to.getWKT()); gdal::Geometry geom(wkt, fromRef); geom.transform(toRef); return geom.wkt(); }