mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 13:03:54 +00:00
Open in another app generates geo: URI with a q= query compatible with Google Maps
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
committed by
Konstantin Pastbin
parent
30718e106e
commit
972cefb074
@@ -345,7 +345,7 @@ UNIT_TEST(GenerateShortShowMapUrl_UnicodeMixedWithOtherChars)
|
||||
UNIT_TEST(GenerateGeoUri_SmokeTest)
|
||||
{
|
||||
string res = GenerateGeoUri(33.8904075, 35.5066454, 16.5, "Falafel M. Sahyoun");
|
||||
TEST_EQUAL("geo:33.8904075,35.5066454?z=16.5(Falafel%20M.%20Sahyoun)", res, ());
|
||||
TEST_EQUAL("geo:33.8904075,35.5066454?z=16.5&q=33.8904075,35.5066454(Falafel%20M.%20Sahyoun)", res, ());
|
||||
|
||||
// geo:33.8904075,35.5066454?z=16.5(Falafel%20M.%20Sahyoun)
|
||||
// geo:33.890408,35.506645?z=16.5(Falafel%20M.%20Sahyoun)
|
||||
|
||||
@@ -107,6 +107,8 @@ std::string GenerateGeoUri(double lat, double lon, double zoom, std::string cons
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "geo:" << std::fixed << std::setprecision(7) << lat << ',' << lon << "?z=" << std::setprecision(1) << zoom;
|
||||
// For Google Maps compatibility, otherwise it doesn't select the point on the map, only shows the area.
|
||||
oss << "&q=" << std::setprecision(7) << lat << ',' << lon;
|
||||
|
||||
if (!name.empty())
|
||||
oss << '(' << url::UrlEncode(name) << ')';
|
||||
|
||||
Reference in New Issue
Block a user