Problem loading map from file

Topics: Help
Jun 19, 2012 at 9:44 PM
Edited Jun 19, 2012 at 9:51 PM

I have created a new map provider which loads a satellite image from a local file. The image loads OK,
but then tiles the same image over and over. At zoom = 1 I get no image displayed.
I'm hoping someone else has gotten this to work and can help me figure out why this does not work.
Here are the main code changes in my new provider:

     public override PureImage GetTileImage(GPoint pos, int zoom)
         string url = MakeTileImageUrl(pos, zoom, LanguageStr);

         return GetTileImageFromFile(url);
         //return GetTileImageUsingHttp(url);


      string MakeTileImageUrl(GPoint pos, int zoom, string language)
         string sec1 = string.Empty; // after &x=...
         string sec2 = string.Empty; // after &zoom=...
         GetSecureWords(pos, out sec1, out sec2);

         //return string.Format(UrlFormat, UrlFormatServer, GetServerNum(pos, 4), UrlFormatRequest, Version, language, pos.X, sec1, pos.Y, zoom, sec2, Server);
         return UrlFormat;

      static readonly string UrlFormatServer = "khm";
      static readonly string UrlFormatRequest = "kh";
      //static readonly string UrlFormat = "http://{0}{1}.{10}/{2}/v={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
      static readonly string UrlFormat = "C:\\Users\\RICKGOULIAN\\Pictures\\gilbert.tif";

   New method in GMapProvider.cs:
      public PureImage GetTileImageFromFile(string url)
          PureImage ret = null;

          byte[] buff = System.IO.File.ReadAllBytes(url);
          System.IO.MemoryStream ms = new System.IO.MemoryStream();
          ms.Write(buff, 0, buff.Length);
          ret = TileImageProxy.FromStream(ms);
          if (ret != null)
              ret.Data = ms;
              ret.Data.Position = 0;

          return ret;

Jul 16, 2012 at 4:07 PM

well you load the same tile, so you see the same tile ;}