RadMap WMTS support

6 posts, 0 answers
  1. Peter
    Peter avatar
    64 posts
    Member since:
    Oct 2016

    Posted 17 Aug 2018 Link to this post

    I've previously asked if Telerik RadMap could add support for WMTS (https://feedback.telerik.com/Project/143/Feedback/Details/202414-map-add-support-for-wmts-map-source) but unfortunately this has not yet been scheduled for development. We now have an important customer that requires that we display maps from a WMTS source using map projection EPSG:4326

    I have implemented a custom tile source (following instructions here: https://docs.telerik.com/devtools/wpf/controls/radmap/how-to/howto-custom-provider) and managed to get it to render a WMTS service successfully, provided that service supports EPSG:3857 (or EPSG:900913 aka GoogleMapsCompatible) and I use the Telerik MercatorProjection (which I think supports Web Mercator, not true Mercator projection).

    When I try to use a tile source that uses EPSG:4326 which uses true Mercator projection (I think) the tiles don't appear in the correct place (although zooming in, does correctly show increasing levels of details). A typical characteristic of a 4326 tile source is that it is wider than it is high e.g. the number of tile matrix rows at any zoom level is half as many as there are columns.

    The article describing how to create a custom provider talks about using "the actual projection used by the provider". I've tried to create a custom projection which would allow EPSG:4326 data to be displayed however it's not clear to me how to write a custom projection. EPSG:4326 is essentially a mercator projection so I've tried overriding Telerik's MarcatorProjection and modifying some properties (e.g. scale, offset) but without much success.

    It might be possible for me to figure out the url for a zoom/x/y combination if I could understand how the MultiScaleTileSource determined which tiles to request for any given geographic area, or if I could somehow override the algorithm it uses to determine which tiles to request. Can you tell me anything about the mapping between geographic area to the tiles to request (zoom/x/y combination)?

    Do you have any ideas on how I might proceed with this task? Any other pointers or suggestions would be gratefully received!

    My company does have a license for DevCraft Ultimate - if I can use this in any way to get more detailed help/support please let me know.

    Thanks
    Pete
  2. Jason D
    Jason D avatar
    130 posts
    Member since:
    Jan 2011

    Posted 17 Aug 2018 in reply to Peter Link to this post

    I'm not sure if this will help, but we import data from a variety of projections. I convert it all to Web Mercator with DotSpatial and do the math to figure out which coordinates are mapped to which tiles and pixel positions. This is probably the key piece code for me in doing that:

        Public Shared Function CalculateMetersPerPixel(ByVal aiZoomLevel As Int32) As Double
            Const cfWorldSize As Double = 40075016.6855784 'meters
            Return ((cfWorldSize / (2 ^ aiZoomLevel)) / 256)
        End Function

  3. Peter
    Peter avatar
    64 posts
    Member since:
    Oct 2016

    Posted 17 Aug 2018 in reply to Jason D Link to this post

    Hi Jason,

    Thanks for trying to help. Unfortunately we need to be able to consume the map tiles from the external source directly. We don't have the option to convert to Web Mercator.In case my previous post was unclear, it's the map background data we need and not just shape data for example.

    Thanks for mentioning DotSpatial though. Might be useful.

     

    Thanks

    Pete

  4. Jason D
    Jason D avatar
    130 posts
    Member since:
    Jan 2011

    Posted 17 Aug 2018 Link to this post

    I see. I have not implemented a custom projection before, only a provider and source. However, if you use a projection other than Mercator, you may not be able to see the base map (https://www.telerik.com/forums/custom-projection). Although that is an old post.

    I do have a suggestion that seems a bit klunky, but might work. In your provider's GetTile or GetCachedTile, you can figure out the coordinates of the requested tile. Then convert/map those coordinates to your own tile. If your provider's tiles do not have the same positions (or size), then you would need to create a new bitmap using the portions of the tiles you need.

    A good article on tile mapping to geography:

    https://msdn.microsoft.com/en-us/library/bb259689.aspx

  5. Jason D
    Jason D avatar
    130 posts
    Member since:
    Jan 2011

    Posted 17 Aug 2018 in reply to Jason D Link to this post

    Can't edit...

    That will probably only work if the meters per pixel are the same as Mercator or you would have to stretch the image :P It sounds klunky to me because it feels like "implementing" a projection at the tile level rather than the data level. Hopefully Telerik can be more useful.

  6. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2420 posts

    Posted 22 Aug 2018 Link to this post

    Hello Pete,

    What I could suggest you is to prepare a project showing your current tiles provider implementation and the source from where the tiles are fetched. And send it over the support ticketing system from your telerik.com account. This way someone could take a look at your implementation and see how to help you proceed with your scenario.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top