MCPcopy Create free account
hub / github.com/PDAL/PDAL / wkt

Method wkt

pdal/Geometry.cpp:297–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295
296
297std::string Geometry::wkt(double precision, bool bOutputZ) const
298{
299 // Important note: The precision is not always respected. Using GDAL
300 // it can only be set once. Because of this, there's no point in saving
301 // away the current OGR_WKT_PRECISION. Same for OGR_WKT_ROUND.
302 //
303 // Also note that when abs(value) < 1, f-type formatting is used.
304 // Otherwise g-type formatting is used. Precision means different things
305 // with the two format types. With f-formatting it specifies the
306 // number of places to the right of the decimal. In g-formatting, it's
307 // the minimum number of digits. Yuck.
308
309 std::string p(std::to_string((int)precision));
310 CPLSetConfigOption("OGR_WKT_PRECISION", p.data());
311 CPLSetConfigOption("OGR_WKT_ROUND", "FALSE");
312
313 char *buf;
314 OGRErr err = m_geom->exportToWkt(&buf);
315 if (err != OGRERR_NONE)
316 throw pdal_error("Geometry::wkt: unable to export geometry to WKT.");
317 std::string wkt(buf);
318 CPLFree(buf);
319 return wkt;
320}
321
322std::string Geometry::wkb() const
323{

Callers 6

initializeMethod · 0.45
TESTFunction · 0.45
prepareGeometryMethod · 0.45
readyMethod · 0.45
doneMethod · 0.45
Geometry.cppFile · 0.45

Calls 1

dataMethod · 0.45

Tested by 1

TESTFunction · 0.36