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

Method fetchSpatialReference

plugins/pgpointcloud/io/PgReader.cpp:201–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199
200
201pdal::SpatialReference PgReader::fetchSpatialReference() const
202{
203 // Fetch the WKT for the SRID to set the coordinate system of this stage
204 log()->get(LogLevel::Debug) << "Fetching SRID ..." << std::endl;
205
206 uint32_t pcid = fetchPcid();
207
208 std::ostringstream oss;
209 oss << "SELECT srid FROM pointcloud_formats WHERE pcid = " << pcid;
210
211 std::string srid_str = pg_query_once(m_session, oss.str());
212 if (srid_str.empty())
213 throwError("Unable to fetch srid for this table and column");
214
215 int32_t srid = atoi(srid_str.c_str());
216 log()->get(LogLevel::Debug) << " got SRID = " << srid << std::endl;
217
218 oss.str("");
219 oss << "EPSG:" << srid;
220
221 if (srid >= 0)
222 return pdal::SpatialReference(oss.str());
223 else
224 return pdal::SpatialReference();
225}
226
227
228void PgReader::ready(PointTableRef /*table*/)

Callers

nothing calls this directly

Calls 6

pg_query_onceFunction · 0.85
strMethod · 0.80
logFunction · 0.50
SpatialReferenceClass · 0.50
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected