trekarta
trekarta copied to clipboard
WMS and WMTS support
Hello,
I can see in the code that Trekarta supports OnlineTileSource
s and I'd like to add a custom WMTS (or maybe WMS) service. I feel like I would need to create a new app with an appropriate Content Provider to do that.
- Any known pitfall?
- I couldn't find any Java/Kotlin WMTS implementation. I wonder if services used in providers like Austrian OGD Basemap for Trekarta don't use WMTS or WMS though. Any suggestion?
Thanks!
I've managed to get my WMTS map basically working with Trekarta. The main limitation I faced was that the provided maps have to be hard-coded into provider's resources. As far as I understand, you can't provide just one WMTS content provider letting the user choosing maps to use in Trekarta.
Do you mean dynamic source? Or any number of sources?
BTW, sounds to be very promising add-on!
@qnga , there are two options:
- Rewrite map plugin API to use dynamic content provider for map settings instead of static resources.
- Integrate this functionality directly in Trekarta.
This is up to you to decide. I would support any decision.
@qnga I've made amendments to your code. Somehow I omitted that you removed support for min and max zoom. They are required by app logic because different sources have different limits. I've also updated all my map plugins to new API and they work well. So you can consider new API stable. You can look, how I pass zoom limits here (simple) and here (conditionally). I've also restored passing license info (it's optional). It's not used yet but I have to show it to user on map selection.
I plan to release these changes later this month.
Thanks, I got my maps working. Out of curiosity, what can min and max zoom tell you if you don't have minTileCol, maxTileCol, minTileRow and maxTileRow? Maps don't cover the whole world at a given zoom level, so I assumed that we can't predict wether a tile is available anyway.
There are two issues here.
- TileLayer has to know maximum available zoom because it uses tiles from previous zoom and rescales them for larger zooms.
- The logic is that maps can stack one on another. So zoom is used to sort them in layer stack.
I've published new version containing your amendments. Would you make your plugin publicly available?
Ok! I can push it onto Github if you're interested, but I don't have time to promote it at the moment
It would be great. I would also like to publish it in Google Play. I can later transfer it to your account if you wish.
Actually I've never been clear about what my plugin does! Unfortunately, I found out that WMTS is a quite flexible protocol so it would be hard to automatically add maps from providers I know nothing about. Currently, my plugin supports official outdoor maps from France (no longer works for a while), Spain and UK. I think I can manage to offer the ability to manually add most of maps asking users for WMTS technical details. That won't be within everybody's reach though...
Still interested?
Of course 😀
BTW, are you a native french speaker? May be you can help localize Trekarta?
Yes, I'm native french speaker. I could have a look, though I don't know well most of the app so I may lack translation context.
I have created translation instructions: https://github.com/andreynovikov/trekarta/wiki/Translation There's also a link to online tool for translation.
Okay! I basically rewrote my plugin, it should be presentable in a few weeks.
I'm mostly done: https://github.com/qnga/trekarta-additional-maps
I guess I will need an icon. Any suggestion?
I suggest using the same icon style as other map plugins: https://github.com/andreynovikov/trekarta-online-maps/tree/master/resources
Plugins with hard-coded map sources use map image of the source: https://github.com/andreynovikov/trekarta-online-maps/blob/master/basemap.at/resources/icon.png
You can place "WMS" or some other descriptive test inside blank rectangle.