Core methods

Jul 27, 2009 at 11:46 AM

Hi radioman

I have a piece of code like this in a WCF Service:

 

        public byte[] GetImage(ImageCriteria criteria)
        {
            GMaps map = Singleton<GMaps>.Instance;
            Point point = map.FromLatLngToPixel(criteria.Lat, criteria.Lng, criteria.Zoom);
            point = map.FromPixelToTileXY(point);
            var image = map.GetImageFrom((MapType)criteria.MapType, point, criteria.Zoom) as GMapImage;
            if (image != null)
            {
                var memoryStream = new MemoryStream();
                map.ImageProxy.Save(memoryStream, image);
                return memoryStream.ToArray();
            }

            return null;
        }

 

 

This is not compiling anymore since FromLatLngToPixel and FromPixelToTileXY methods are moved to GMap.NET.Internals.Core which is internal.

Is it possible to uninternalize these methods? ty

 

Coordinator
Jul 27, 2009 at 12:03 PM
Edited Jul 27, 2009 at 12:05 PM

check BigMapMaker-ConsoleApplication, its something like that:

         GMaps.Instance.Mode = AccessMode.ServerAndCache;
         GMaps.Instance.ImageProxy = new WindowsFormsImageProxy();

         MapType type = MapType.GoogleMap;
         PureProjection pr = new MercatorProjection(); 
         int zoom = 12;
         RectLatLng area = RectLatLng.FromLTRB(25.013809204101563, 54.832138557519563, 25.506134033203125, 54.615623046071839);
         
         using(Bitmap bmpDestination = new Bitmap(pxDeltaA.X, pxDeltaA.Y))
         {
               // get tiles & combine into one
               foreach(var p in tileArea)
               {
                  Console.WriteLine("Downloading[" + p + "]: " + tileArea.IndexOf(p) + " of " + tileArea.Count);

                  WindowsFormsImage tile = GMaps.Instance.GetImageFrom(type, p, zoom) as WindowsFormsImage;
                  if(tile != null)
                  {
                     using(tile)
                     {
                        using(Graphics gfx = Graphics.FromImage(bmpDestination))
                        {
                           gfx.DrawImage(tile.Img, (p.X - minX)*pr.TileSize.Width, (p.Y - minY)*pr.TileSize.Width);
                        }
                     }
                  }
               }
       }
Dec 2, 2011 at 4:49 AM
Edited Dec 2, 2011 at 4:49 AM

how to get from here on   drawing with markers and routs? 

Coordinator
Dec 2, 2011 at 6:34 AM

check static image maker in windows forms demo

Dec 2, 2011 at 9:42 AM

without form, I have in console mode

Coordinator
Dec 2, 2011 at 9:48 AM

there is no difference

Dec 4, 2011 at 7:12 AM

 

Hello radioman,

  i want to make a "static Map" Screenshot in size 640x480.

how to get the images to size

Coordinator
Dec 4, 2011 at 7:50 AM

?

Dec 4, 2011 at 8:19 AM
Edited Dec 4, 2011 at 8:20 AM

All the images were the same size, such as 640x480 or 800x600. and with all markers and roads

Coordinator
Dec 4, 2011 at 8:39 AM

so whats the problem?

Dec 4, 2011 at 9:11 AM

 

how to do it, tell me please

Coordinator
Dec 4, 2011 at 9:13 AM

by coding ;} there is no 'official' static map api for now, check the demos and modify for your own needs