Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
GeographicMap - map tiles don't display when setting WorldRect
posted

I am using a geographic map with a static geotiff image that I converted to tiles.

If I don't specify the world rect, my map and symbol series both show, but my symbol series is in the wrong location. When I set the world rect to the parameters of my image, then the symbol series shows accurately but the map does not appear at all.

It seems to be a similar problem to this post which had no answer given: https://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/72598/setting-worldrect-of-xamgographicmap-no-calls-to-gettilelayers-of-custom-maptilesource

Some code:

    public class LocalMapTileSource : Maps.XamMultiScaleTileSource
    {
        public LocalMapTileSource() : base(3033, 3033, 256, 256, 0) { }
        private const string TileOriginalPath = @"C:\ProgramData\SmartSnow7\Tiles\{Z}\{X}\{Y}.png";

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, System.Collections.Generic.IList<object> tileImageLayerSources)
        {
            var zoom = tileLevel - 8;
            var invY = (int)Math.Pow(2.0, zoom) - tilePositionY - 1;
            if (zoom > 0)
            {
                var uriString = TileOriginalPath;
                uriString = uriString.Replace("{Z}", zoom.ToString());
                uriString = uriString.Replace("{X}", tilePositionX.ToString());
                uriString = uriString.Replace("{Y}", invY.ToString());
                tileImageLayerSources.Add(new Uri(uriString));
            }
        }
    }

        public InfragisticsMap()
        {
            InitializeComponent();
            GeoMap.BackgroundContent = new LocalMapImagery();
            GeoMap.WorldRect = new Rect(8.3713675, 46.7982968, 0.0119369, 0.0081759);
        }

And the information about my original geotiff image:

Driver: GTiff/GeoTIFF
Files: LocalMap.tif
Size is 3033, 3034
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (8.371367454528810,46.798296765380201)
Pixel Size = (0.000003935683079,-0.000002694757344)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2019:01:19 10:44:48
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=Windows Photo Editor 10.0.10011.16384
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (   8.3713675,  46.7982968) (  8d22'16.92"E, 46d47'53.87"N)
Lower Left  (   8.3713675,  46.7901209) (  8d22'16.92"E, 46d47'24.44"N)
Upper Right (   8.3833044,  46.7982968) (  8d22'59.90"E, 46d47'53.87"N)
Lower Right (   8.3833044,  46.7901209) (  8d22'59.90"E, 46d47'24.44"N)
Center      (   8.3773359,  46.7942088) (  8d22'38.41"E, 46d47'39.15"N)
Band 1 Block=3033x1 Type=Byte, ColorInterp=Red
Band 2 Block=3033x1 Type=Byte, ColorInterp=Green
Band 3 Block=3033x1 Type=Byte, ColorInterp=Blue