Menu

#311 perform digital zoom with customMultiLayerMapSource

Not_planned
open
nobody
None
1
2024-06-26
2024-06-25
Cyril42e
No

Hi,

I made a custom multilayer map source in order to add hillshade (from MapTiler) to a vector map (from OpenAndroMaps). It works great, except that the hillshade tiles are limited to zoom level 12, and when I try to zoom more Mobac does not display anything except an error tile mentioning "400 Bad Request Out of bounds" which is what the tile server responds when requested for zoom level beyond 12. It does not display the valid layers, and does not perform digital zoom on the missing layers.

I found a workaround by writing a local tile server that directly forwards requests for zoom level <=12, and performs digital zoom on the fly for zoom levels >12 (requests tile 12, and performs crop and scale up). But it is a bit cumbersome, and I was thinking that it would be pretty easy and useful for Mobac to perform it automatically (i.e. when zooming beyond the configured maxZoom of one layer, but not of all layers, then perform digital zoom on the max zoom available for each layer).

Or maybe there is another way to do it, easier than running a local tile server?

Thanks

Discussion

  • r_x

    r_x - 2024-06-25

    I see an intermediate way that behaves like running a local tile server inside MOBAC:

    The implementation of non-custom map sources are Java classes. Multiple map source together are packed into one mapsource jar package.
    The structure of MOBAC source code allows to create new map sources that can provide not only the URLs of map tiles but also implement totally custom loading mechanisms like generating images on the fly (or based on a tile form a different layer).

    For someone with some Java skills implementing this isn't a big problem. A new map source package and a new map source isn't a big problem to add in MOBAC's gradle project. And a sample map source that generates tile son-the fly is mobac.mapsources.impl.DebugMapSource#DebugMapSource.

     
  • r_x

    r_x - 2024-06-25
    • Group: Already_implemented --> Not_planned
     
  • Cyril42e

    Cyril42e - 2024-06-26

    Interesting! Would it be possible to include this source in a Multilayer source, or to make directly the java map source a multilayer source?

    But anyway in the end it would indeed be a bit easier to use (though a simple script can synchronize the execution of the local tile server and Mobac), however it would also be more complicated to configure (in order to change the server URL, API key, ...) by requiring to recompile the package, especially if the multilayer has to be compiled in java. It also requires additional development that is specific to Mobac but without being easily reusable by other users for creating their custom map sources (contrary to my initial suggestion). I'll let you know if I change my mind and implement something like that though.

    Thanks for your inputs!

     

Log in to post a comment.