From 6c0a14c5dc0cf8c0d690003218bd9a40735cdf63 Mon Sep 17 00:00:00 2001 From: Desone Burns II Date: Fri, 25 Sep 2020 15:03:00 -0700 Subject: [PATCH] Fix raster handling --- profiles/lib/way_handlers.lua | 3 +++ src/extractor/raster_source.cpp | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/profiles/lib/way_handlers.lua b/profiles/lib/way_handlers.lua index b13410235..0afe5e16e 100644 --- a/profiles/lib/way_handlers.lua +++ b/profiles/lib/way_handlers.lua @@ -598,6 +598,9 @@ function WayHandlers.weights(profile,way,result,data) if (result.backward_mode ~= mode.inaccessible and result.backward_speed > 0) then result.backward_rate = 1 end + elseif profile.standard_rate then + result.forward_rate = 1 + result.backward_rate = 1 end end diff --git a/src/extractor/raster_source.cpp b/src/extractor/raster_source.cpp index 10b517ef7..16037747b 100644 --- a/src/extractor/raster_source.cpp +++ b/src/extractor/raster_source.cpp @@ -42,8 +42,8 @@ RasterDatum RasterSource::GetRasterData(const int lon, const int lat) const return {}; } - const std::size_t xth = static_cast(round((lon - xmin) / xstep)); - const std::size_t yth = static_cast(round((ymax - lat) / ystep)); + const std::size_t xth = static_cast(round((lat - xmin) / xstep)); + const std::size_t yth = static_cast(round((lon - ymin) / ystep)); return {raster_data(xth, yth)}; } @@ -57,9 +57,7 @@ RasterDatum RasterSource::GetRasterInterpolate(const int lon, const int lat) con } const auto xthP = (lon - xmin) / xstep; - const auto ythP = - (ymax - lat) / - ystep; // the raster texture uses a different coordinate system with y pointing downwards + const auto ythP = (lat - ymin) / ystep; const std::size_t top = static_cast(fmax(floor(ythP), 0)); const std::size_t bottom = static_cast(fmin(ceil(ythP), height - 1));