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

Method init

io/private/las/Srs.cpp:44–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42{
43
44void Srs::init(const VlrList& vlrs, std::vector<SrsType> srsOrder, bool useWkt, LogPtr log)
45{
46 bool specifiedOrder = srsOrder.size();
47
48 m_srs = SpatialReference();
49 m_geotiffString.clear();
50
51 if (srsOrder.empty())
52 {
53 if (useWkt)
54 srsOrder = { SrsType::Wkt2, SrsType::Proj, SrsType::Wkt1 };
55 else
56 srsOrder = { SrsType::Wkt2, SrsType::Proj, SrsType::Geotiff };
57 }
58
59 const Vlr *wkt2 = findVlr(TransformUserId, LASFWkt2recordId, vlrs);
60 const Vlr *proj = findVlr(PdalUserId, PdalProjJsonRecordId, vlrs);
61 const Vlr *gtiff = findVlr(TransformUserId, GeotiffDirectoryRecordId, vlrs);
62 const Vlr *wkt1 = findVlr(TransformUserId, WktRecordId, vlrs);
63 if (!wkt1)
64 wkt1 = findVlr(LiblasUserId, WktRecordId, vlrs);
65
66 if (wkt1 && gtiff && log)
67 log->get(LogLevel::Debug) << "File contains both "
68 "WKT and GeoTiff VLRs which is disallowed." << std::endl;
69
70 try
71 {
72 for (const SrsType& type : srsOrder)
73 {
74 if (type == SrsType::Wkt2 && wkt2)
75 {
76 extractWkt(wkt2);
77 break;
78 }
79 else if (type == SrsType::Proj && proj)
80 {
81 extractWkt(proj);
82 break;
83 }
84 else if (type == SrsType::Wkt1 && wkt1)
85 {
86 extractWkt(wkt1);
87 break;
88 }
89 else if (type == SrsType::Geotiff && gtiff)
90 {
91 extractGeotiff(gtiff, vlrs, log);
92 break;
93 }
94 }
95 }
96 catch (...)
97 {
98 if (log)
99 log->get(LogLevel::Error) << "Could not create an SRS.\n";
100 }
101 if (specifiedOrder && m_srs.empty() && log)

Callers 8

initializeLocalMethod · 0.45
initializeMethod · 0.45
readyMethod · 0.45
handleItemMethod · 0.45
handleCatalogMethod · 0.45
handleCollectionMethod · 0.45
handleItemCollectionMethod · 0.45
runMethod · 0.45

Calls 6

findVlrFunction · 0.85
SpatialReferenceClass · 0.50
sizeMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected