| 798 | |
| 799 | |
| 800 | pdal::Polygon TIndexKernel::prepareGeometry(const FileInfo& fileInfo) |
| 801 | { |
| 802 | using namespace gdal; |
| 803 | |
| 804 | Polygon g(fileInfo.m_boundary, fileInfo.m_srs); |
| 805 | if (fileInfo.m_gridHeight && m_doSmooth) |
| 806 | { |
| 807 | double tolerance = 1.1 * fileInfo.m_gridHeight / 2; |
| 808 | double cull = (6 * tolerance * tolerance); |
| 809 | g.simplify(tolerance, cull); |
| 810 | if (g.wkt()[0] == 'P') |
| 811 | { |
| 812 | std::string multi = makeMultiPolygon(g.wkt()); |
| 813 | g = Polygon(multi, fileInfo.m_srs); |
| 814 | } |
| 815 | } |
| 816 | if (m_tgtSrsString.size()) |
| 817 | { |
| 818 | SpatialReference out(m_tgtSrsString); |
| 819 | g.transform(out); |
| 820 | } |
| 821 | |
| 822 | return g; |
| 823 | } |
| 824 | |
| 825 | |
| 826 | std::string TIndexKernel::makeMultiPolygon(const std::string& wkt) |