trekarta icon indicating copy to clipboard operation
trekarta copied to clipboard

WMS and WMTS support

Open qnga opened this issue 2 years ago • 18 comments

Hello,

I can see in the code that Trekarta supports OnlineTileSources 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!

qnga avatar Apr 04 '22 07:04 qnga

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.

qnga avatar Apr 13 '22 13:04 qnga

Do you mean dynamic source? Or any number of sources?

andreynovikov avatar Apr 26 '22 18:04 andreynovikov

BTW, sounds to be very promising add-on!

andreynovikov avatar Apr 26 '22 18:04 andreynovikov

@qnga , there are two options:

  1. Rewrite map plugin API to use dynamic content provider for map settings instead of static resources.
  2. Integrate this functionality directly in Trekarta.

This is up to you to decide. I would support any decision.

andreynovikov avatar Apr 26 '22 18:04 andreynovikov

@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.

andreynovikov avatar Jan 10 '24 09:01 andreynovikov

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.

qnga avatar Jan 18 '24 09:01 qnga

There are two issues here.

  1. TileLayer has to know maximum available zoom because it uses tiles from previous zoom and rescales them for larger zooms.
  2. The logic is that maps can stack one on another. So zoom is used to sort them in layer stack.

andreynovikov avatar Jan 18 '24 12:01 andreynovikov

I've published new version containing your amendments. Would you make your plugin publicly available?

andreynovikov avatar Jan 18 '24 12:01 andreynovikov

Ok! I can push it onto Github if you're interested, but I don't have time to promote it at the moment

qnga avatar Jan 18 '24 12:01 qnga

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.

andreynovikov avatar Jan 18 '24 12:01 andreynovikov

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?

qnga avatar Jan 18 '24 13:01 qnga

Of course 😀

andreynovikov avatar Jan 18 '24 13:01 andreynovikov

BTW, are you a native french speaker? May be you can help localize Trekarta?

andreynovikov avatar Jan 18 '24 16:01 andreynovikov

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.

qnga avatar Jan 18 '24 19:01 qnga

I have created translation instructions: https://github.com/andreynovikov/trekarta/wiki/Translation There's also a link to online tool for translation.

andreynovikov avatar Jan 24 '24 20:01 andreynovikov

Okay! I basically rewrote my plugin, it should be presentable in a few weeks.

qnga avatar Feb 05 '24 13:02 qnga

I'm mostly done: https://github.com/qnga/trekarta-additional-maps

I guess I will need an icon. Any suggestion?

qnga avatar Mar 10 '24 10:03 qnga

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.

andreynovikov avatar Mar 13 '24 13:03 andreynovikov