* Converts lon/lat into coordinates inside a Mercator projection tile (x/y pixel values) * * @param point the lon/lat you want the tile coords for * @param tile_bbox the mercator boundaries of the tile * @return a point (x,y) on the tile defined by tile_bbox */
| 202 | * @return a point (x,y) on the tile defined by tile_bbox |
| 203 | */ |
| 204 | FixedPoint coordinatesToTilePoint(const util::Coordinate point, const BBox &tile_bbox) |
| 205 | { |
| 206 | const FloatPoint geo_point{static_cast<double>(util::toFloating(point.lon)), |
| 207 | static_cast<double>(util::toFloating(point.lat))}; |
| 208 | |
| 209 | const double px_merc = geo_point.x * util::web_mercator::DEGREE_TO_PX; |
| 210 | const double py_merc = util::web_mercator::latToY(util::FloatLatitude{geo_point.y}) * |
| 211 | util::web_mercator::DEGREE_TO_PX; |
| 212 | |
| 213 | const auto px = static_cast<std::int32_t>(std::round( |
| 214 | ((px_merc - tile_bbox.minx) * util::web_mercator::TILE_SIZE / tile_bbox.width()) * |
| 215 | util::vector_tile::EXTENT / util::web_mercator::TILE_SIZE)); |
| 216 | const auto py = static_cast<std::int32_t>(std::round( |
| 217 | ((tile_bbox.maxy - py_merc) * util::web_mercator::TILE_SIZE / tile_bbox.height()) * |
| 218 | util::vector_tile::EXTENT / util::web_mercator::TILE_SIZE)); |
| 219 | |
| 220 | return FixedPoint{px, py}; |
| 221 | } |
| 222 | |
| 223 | std::vector<RTreeLeaf> getEdges(const DataFacadeBase &facade, unsigned x, unsigned y, unsigned z) |
| 224 | { |
no test coverage detected