none
Changing MapTileLayer Size RRS feed

  • Question

  • We've been using the Map Tile Layer system in the WPF Bing Map control for years now and it's been working very well.  We've started pulling in layers from ESRI systems and many of those have been working nicely, too.  Some, however, don't work well when pulling a 256x256 tile.  In order to keep the image from being distorted, they actually return tiles that cover an area that's larger than what is requested.  That results in layers where the data inside a tile actually repeats the data in the tiles around it.

    I've found that if I change the requested size (for instance, if I ask for a 338x256 tile or a 256x194 tile - the exact numbers depend on how the particular ArcGIS service is set up) then I get back a tile that covers an area very close to what I asked for.  I tried changing the TileHeight to match but then all my calculations to change the x/y/zoomLevel that are passed to the GetUri event for the TileSource go crazy because they assume 256x256 tiles.

    I expect it's possible to alter my math (which is based on tile system documentation) to work with any sized tiles but college math was a long time back.  Has anyone already figured out how to change x/y/zoomlevel to a lat/long bounding box?

    Or perhaps there's a better way to get images from non-tiled map sources in ArcGIS than the Extract call I'm making?

    • Edited by Zloth X Friday, August 16, 2019 4:17 PM clarification
    Friday, August 16, 2019 4:14 PM

Answers

  • You'd only be able to bring ESRI services that has the exact same tiling scheme and spatial reference as the Bing Maps service. The Esri services are very dynamic and supports any projection and any (or no) tilingscheme, so that's most likely why many services won't align.

    Also you can use dynamic export of the mapservice into tiles, but I'd heavily advise against that, as it's going to be very slow. If you do anyway though, make sure you request a bounding box that is as tall as wide, in Mercator units, and not in longitude/latitude, so make sure your spatial reference you use for input AND output is 3857.

    I wrote this maaaaany years ago before it was even call Bing maps: https://www.sharpgis.net/post/2007/07/27/The-Microsoft-Live-Maps-and-Google-Maps-projection


    /Morten
    twitter: https://www.twitter.com/dotMorten
    blog: https://www.xaml.dev







    Tuesday, September 3, 2019 6:39 PM

All replies

  • You'd only be able to bring ESRI services that has the exact same tiling scheme and spatial reference as the Bing Maps service. The Esri services are very dynamic and supports any projection and any (or no) tilingscheme, so that's most likely why many services won't align.

    Also you can use dynamic export of the mapservice into tiles, but I'd heavily advise against that, as it's going to be very slow. If you do anyway though, make sure you request a bounding box that is as tall as wide, in Mercator units, and not in longitude/latitude, so make sure your spatial reference you use for input AND output is 3857.

    I wrote this maaaaany years ago before it was even call Bing maps: https://www.sharpgis.net/post/2007/07/27/The-Microsoft-Live-Maps-and-Google-Maps-projection


    /Morten
    twitter: https://www.twitter.com/dotMorten
    blog: https://www.xaml.dev







    Tuesday, September 3, 2019 6:39 PM
  • Hi Zloth,

    I have agreement with Morten's answer from the Bing Maps team as well. Web Mercator (EPSG:3857) is a well-known officially recognized projection. If the ESRI server is returning data in EPSG 3857, then the tile boundaries should match Bing Maps. If they’re returning something outside those bounds the Bing Map control would not support that alignment. If you are requesting tiles in some other projection and trying to use them in the Bing Maps control, your app would need to translate these to ESPG 3857.

    Sincerely,

    IoTGirl

    Tuesday, September 3, 2019 7:58 PM
    Owner
  • Actually, the ESRI services that are tiled seem to be working fine (and much faster).  I suppose they just so happen to be using the same tiling scheme, or something very close to it.  The problems have come from maps that don't have tiled versions.  As far as I know, that forces me to use their Extract function.

    What I ended up doing was querying the ESRI service for the image (using SR 4326), comparing the returned extents to the extents I asked for, then cutting off the edges and stretching the image as needed.  I don't like it much but it appears to be accurate enough.  It's quick, too, though things like small dots on map layers turn into small ovals.  It will likely start to show its inaccuracies more if we start looking closer to the poles.

    So what I actually should do is take the X/Y/Zoom the map requests, convert them to Mercator coordinates, then make my request using those?

    Thursday, September 5, 2019 6:42 PM
  • You will need tile images to be in EPSG 3857 for them to work properly with bing controls. Even if you request the right bounds for a given tile, if the source of the tiles is returning some other projection (like 4326), things won't line up within the tile. It will be worse towards the poles and at lower zoom levels, but you'll get misalignment in every tile. Things like the reported lat/long for mouse click won't align with your imagery, pushpins won't align, etc.
    Friday, September 6, 2019 4:32 PM
    Moderator
  • I altered my code and transformed the lat/long box that was calculated into ESPG 3857 then used those coordinates in the URLs and it's working great!  Thanks folks!

    Monday, September 16, 2019 9:52 PM
  • You are very welcome! Thank you for coming back and confirming your results in the forum.
    Tuesday, September 17, 2019 2:50 AM
    Owner