telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.28k stars 5.22k forks source link

Improve maps by intergrating MapLibre Native #28416

Open louwers opened 1 month ago

louwers commented 1 month ago

Is your feature request related to a problem?

Not sure if it is the same on all platforms, but I have noticed that the static maps looks quite bad and not nearly as polished as the rest of the application.

image

Also when you want to interact with them, it seems to be delegated to another system app (Apple Maps in the case of macOS).

Describe the solution you'd like

Intergrating with MapLibre Native would allow high-resolution maps with interactivity. It is possible to run on the server for static map generation, but it also has Qt bindings for client-side usage.

MapLibre Native is data-source agnostic. There are many commercial tile providers available, but if you just need a simple map projects like Protomaps make hosting your own tiles almost trivial.

It's all permissively licensed and actively developed. MapLibre is an open-source community and organization with many big players behind it. Disclaimer: I am maintainer for MapLibre Native.

Describe alternatives you've considered

Keep the current map.

Investigate other libraries for interactive maps.

Additional context

No response

Aokromes commented 1 month ago

platform wide bugs / requests belongs to https://bugs.telegram.org/

louwers commented 1 month ago

This is platform-specific though.

Aokromes commented 1 month ago

it will need to be same maps platform on every app.

louwers commented 1 month ago

@Aokromes Right now it isn't. The macOS app uses Apple Maps, the Android app uses Google Maps, this Qt app uses some kind of server-side static rendering.

john-preston commented 1 month ago

@louwers I don't quite understand who is going to pay for the servers that provide the tiles to the client. I see https://demotiles.maplibre.org/ in the examples in the repository that you link, but this doesn't look like something you should include in your project. Qt bindings won't work in TDesktop because it can't use QGLWidget in the main app window.

Map thumbnails use server side image generation from openstreetmaps data hosted on the server with some styles and some renderer, I don't know the details, but they're supposed to be fine, I guess.

There is interactive map support in a webview using Mapbox for location sending. It's nice, but it isn't free. I see this project has an alternative to the Mapbox GL library, but there still needs to be a server that feeds tile data to the client and usually it isn't free for huge amounts that may arise in TDesktop.

louwers commented 1 month ago

@john-preston You would be surprised how cheap hosting tiles can be. https://docs.protomaps.com/deploy/cost

john-preston commented 1 month ago

@louwers I believe it's true, but I'm not ready to do that myself, I have too many other things to do..

louwers commented 1 month ago

@john-preston Understood. I think the tile hosting should be simple, the integration is probably the most time-consuming part.

Why can't the desktop app use QGLWidget/QOpenGLWidget? Is it because of macOS? MapLibre Native now also supports Metal, but it still has to be integrated with the Qt platform. And yes, MapLibre started out as a fork from Mapbox' client libraries when they stopped being open-source.

john-preston commented 1 month ago

@louwers On the contrary, macOS is the only system where OpenGL is used unconditionally in the main window of the application :) But on Windows and Linux OpenGL is not reliable enough to use it in the main window (once you create an OpenGL widget, all window pipeline switches to OpenGL path and if you have any problems with drivers / anything, it'll just break the whole app).