MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / GetRasterDataFromSource

Method GetRasterDataFromSource

src/extractor/raster_source.cpp:126–144  ·  view source on GitHub ↗

External function for looking up nearest data point from a specified source

Source from the content-addressed store, hash-verified

124
125// External function for looking up nearest data point from a specified source
126RasterDatum RasterContainer::GetRasterDataFromSource(unsigned int source_id, double lon, double lat)
127{
128 if (RasterCache::getInstance().getLoadedSources().size() < source_id + 1)
129 {
130 throw util::exception("Attempted to access source " + std::to_string(source_id) +
131 ", but there are only " +
132 std::to_string(RasterCache::getInstance().getLoadedSources().size()) +
133 " loaded" + SOURCE_REF);
134 }
135
136 BOOST_ASSERT(lat < 90);
137 BOOST_ASSERT(lat > -90);
138 BOOST_ASSERT(lon < 180);
139 BOOST_ASSERT(lon > -180);
140
141 const auto &found = RasterCache::getInstance().getLoadedSources()[source_id];
142 return found.GetRasterData(static_cast<std::int32_t>(util::toFixed(util::FloatLongitude{lon})),
143 static_cast<std::int32_t>(util::toFixed(util::FloatLatitude{lat})));
144}
145
146// External function for looking up interpolated data from a specified source
147RasterDatum

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 5

exceptionClass · 0.85
to_stringFunction · 0.85
toFixedFunction · 0.85
GetRasterDataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected