Beispiel #1
0
 /**
  * Create a tile with the given zoom level that contains the given
  * location.
  *
  * The values are not checked for validity.
  *
  * @pre @code location.valid() && zoom <= 30 @endcode
  */
 explicit Tile(uint32_t zoom, const osmium::Location& location) :
     z(zoom) {
     assert(zoom <= 30u);
     assert(location.valid());
     const auto coordinates = lonlat_to_mercator(location);
     x = mercx_to_tilex(zoom, coordinates.x);
     y = mercy_to_tiley(zoom, coordinates.y);
 }
Beispiel #2
0
 /**
  * Create a tile with the given zoom level that contains the given
  * location.
  *
  * The values are not checked for validity.
  *
  * @pre @code location.valid() && zoom <= 30 @endcode
  */
 explicit Tile(uint32_t zoom, const osmium::Location& location) :
     z(zoom) {
     assert(zoom <= 30u);
     assert(location.valid());
     const osmium::geom::Coordinates c = lonlat_to_mercator(location);
     const int32_t n = 1 << zoom;
     const double scale = detail::max_coordinate_epsg3857 * 2 / n;
     x = uint32_t(detail::restrict_to_range<int32_t>(int32_t((c.x + detail::max_coordinate_epsg3857) / scale), 0, n-1));
     y = uint32_t(detail::restrict_to_range<int32_t>(int32_t((detail::max_coordinate_epsg3857 - c.y) / scale), 0, n-1));
 }
 void add_location(const osmium::Location& location) {
     if (location.valid()) {
         m_dirty_tiles.emplace(m_zoom, location);
     }
 }