std::string Polygon::json(double precision) const { std::ostringstream prec; prec << precision; char **papszOptions = NULL; papszOptions = CSLSetNameValue(papszOptions, "COORDINATE_PRECISION", prec.str().c_str() ); std::string w(wkt()); gdal::SpatialRef srs(m_srs.getWKT(pdal::SpatialReference::eCompoundOK)); gdal::Geometry g(w, srs); char* json = OGR_G_ExportToJsonEx(g.get(), papszOptions); std::string output(json); OGRFree(json); return output; }
char* OGR_G_ExportToJson( OGRGeometryH hGeometry ) { return OGR_G_ExportToJsonEx(hGeometry, NULL); }