glm::dvec4 MercatorProjection::TileLonLatBounds(const TileID _tileCoord) const { glm::dvec2 boundMin, boundMax; glm::dvec4 tileBounds, lonLatBounds; tileBounds = TileBounds(_tileCoord); boundMin = MetersToLonLat(glm::dvec2(tileBounds.x, tileBounds.y)); boundMax = MetersToLonLat(glm::dvec2(tileBounds.z, tileBounds.w)); lonLatBounds = glm::dvec4(boundMin.x, boundMin.y, boundMax.x, boundMax.y); return lonLatBounds; }
Query::Query(const std::vector<std::string>& tokens) : Query(tokens[3], tokens[4]) { for (auto it = tokens.begin() + 5; it != tokens.end(); ++it) { if ((*it) == "tile") { const auto key = nextToken(it); const auto x = std::stoi(nextToken(it)); const auto y = std::stoi(nextToken(it)); ulong z = std::stoi(nextToken(it)); zoom = z; resolution = std::stoi(nextToken(it)); emplaceTile(std::stoul(key), Tile(x, y, z)); } else if ((*it) == "region") { const auto key = nextToken(it); ulong z = std::stoi(nextToken(it)); zoom = z; int x0 = (int)std::stof(nextToken(it)); int y0 = (int)std::stof(nextToken(it)); int x1 = (int)std::stof(nextToken(it)); int y1 = (int)std::stof(nextToken(it)); emplaceRegion(std::stoul(key), TileBounds(x0, y0, x1, y1, z)); } else if ((*it) == "field") { group.emplace(nextToken(it)); } else if ((*it) == "where") { std::vector<std::string> uri = util::split(nextToken(it), std::regex("&")); for (auto clause : uri) { std::vector<std::string> literals = util::split(clause, std::regex("=|:")); if ((literals.size() - 1) <= 0) continue; std::vector<int> values; for (size_t i = 1; i < literals.size(); i++) { values.emplace_back(std::stoi(literals[i])); } std::sort(values.begin(), values.end()); emplaceWhere(literals[0], values); } } else if ((*it) == "tseries") { auto key = nextToken(it); temporal_t lower = std::stoul(nextToken(it)); temporal_t upper = std::stoul(nextToken(it)); tseries.emplace(key, TemporalInterval(lower, upper)); } } }