Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all 3384 articles
Browse latest View live

New Post: Help needed for new mapprovider and projection

$
0
0
Hi
Im trying to use this great control with a tileserver with tiles for Denmark. Unfortunately I cannot get it to work.
According to the documentation on the tileserver it is using a projection called ETRS89, UTM zone 32, EPSG:25832 (http://epsg.io/25832), with a tilesize of 256 * 256 pixel. The server is also follows the WMTS standard OGC.

There is a tiling schema on this pdf: http://kortforsyningen.dk/articles/tiling44.pdf
There is some google translated documentation on this site: https://translate.google.com/translate?sl=da&tl=en&js=y&prev=_t&hl=da&ie=UTF-8&u=http%3A%2F%2Fkortforsyningen.dk%2Farticles%2FTile_wmts_skaermkort.htm&edit-text=

urlformat for the server: http://kortforsyningen.kms.dk/topo_skaermkort?service=WMTS&request=GetTile&version=1.0.0&layer=dtk_skaermkort&style=default&tilematrixset=View1&tilematrix=L{0:00}&tilerow={1}&tilecol={2}&format=image/jpeg&login=greatmaps&password=greatmaps123

Sample: Zoomlevel 0
http://kortforsyningen.kms.dk/topo_skaermkort?service=WMTS&request=GetTile&version=1.0.0&layer=dtk_skaermkort&style=default&tilematrixset=View1&tilematrix=L00&tilerow=0&tilecol=0&format=image/jpeg&login=greatmaps&password=greatmaps123

I dont know much about geographically mathematics and theory, and have blindly tried to edit existing mapprovider and projections unsuccessfully.
So I hope somebody can lead me in the right direction, and tell me what has to be done before I can display the map of Denmark in this control or if gmap at all compatible with this tileserver.

Thanks in advance:-)

New Post: Visual Basic 2010 Express

$
0
0
Hello to all
I would use gmap.net with VB2010 Express. I was able to view the map, to find a location, but I can not see the marker.
I tried the examples but it seems that the syntax of the instructions is incorrect. There is a demo project from which to draw inspiration?
thanks

New Post: why Prefetch the map are always limit to 256M?

$
0
0
I'm trying to generate a offline regional map. but the AppData\Local\GMap.NET\TileDBv5\en\Data.gmdb is always limited to 256M, who knows the reason?

anything else of the code should I change?

Please expert give me a hand for this issue, which already waste 1 week efforts on it :(

New Post: Help needed for new mapprovider and projection

$
0
0
Im almost there, but dont understand how to place/scale the tiles to the control in the correct way.
Im using the project Fork: radioman/BuenosAires, and replacing the BuenosAiresWMSProvider and the GKBAProjection with this one:
/// <summary>
   /// Denmark, WMTS 
   /// </summary>
   public class denmarkWMTSProvider : GMapProvider
   {
      public static readonly denmarkWMTSProvider Instance;


      
      denmarkWMTSProvider()
      {
         InvertedAxisY = false;
       //  Area = RectLatLng.FromLTRB(3.32016, 58.35397, 17.55777, 53.113655);
         MaxZoom = 11;
         MinZoom = 0;
      }



      static denmarkWMTSProvider()
      {
          Instance = new denmarkWMTSProvider();
      }

      #region GMapProvider Members

      readonly Guid id = new Guid("E804CEF8-41C6-41B5-BCA7-6EA5348DC555");
      public override Guid Id
      {
         get
         {
            return id;
         }
      }

      readonly string name = "Denmark, WMTS";
      public override string Name
      {
         get
         {
            return name;
         }
      }

      GMapProvider[] overlays;
      public override GMapProvider[] Overlays
      {
         get
         {
            if(overlays == null)
            {
               overlays = new GMapProvider[] { this };
            }
            return overlays;
         }
      }

      public override PureProjection Projection
      {
         get
         {
             return ETRS89Projection.Instance;
         }
      }

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

         return GetTileImageUsingHttp(url);
      }

      #endregion

      string MakeTileImageUrl(GPoint pos, int zoom, string language)
      {
/*      
          var tileWorldUnits = GKBAProjection.GetPixelSize(zoom) * Projection.TileSize.Width;
         var minX = (long)(pos.X * tileWorldUnits + GKBAProjection.Instance.OriginX);
         var minY = (long)(pos.Y * tileWorldUnits + GKBAProjection.Instance.OriginY);
         var maxX = (long)(minX + tileWorldUnits);
         var maxY = (long)(minY + tileWorldUnits);
          */
        
         return string.Format(UrlFormat, zoom, pos.Y, pos.X);
      }

      static readonly string UrlFormat = "http://kortforsyningen.kms.dk/topo_skaermkort?service=WMTS&request=GetTile&version=1.0.0&layer=dtk_skaermkort&style=default&tilematrixset=View1&tilematrix=L{0:00}&tilerow={1}&tilecol={2}&format=image/jpeg&login=greatmaps&password=greatmaps123";

      
   }

   public class ETRS89Projection : PureProjection
   {
       public static readonly ETRS89Projection Instance = new ETRS89Projection();

      static readonly double MinLatitude = 53.113655;
       static readonly double MaxLatitude = 58.35397;

       static readonly double MinLongitude = 3.32016;
       static readonly double MaxLongitude = 17.55777;
      
        static readonly double MinX = 120000;
        static readonly double MinY = 5900000;
        static readonly double MaxX = 1000000;
        static readonly double MaxY = 6500000;

        public readonly double OriginX = 120000;
        public readonly double OriginY = 5900000;
      
      public override RectLatLng Bounds
      {
         get
         {
            return RectLatLng.FromLTRB(MinLongitude, MaxLatitude, MaxLongitude, MinLatitude);

         }
      }

      GSize tileSize = new GSize(256, 256);
      public override GSize TileSize
      {
         get
         {
            return tileSize;
         }
      }

      public override double Axis
      {
         get
         {
            //return 6378137;
             return 6378137;
             
         }
      }

      public override double Flattening
      {
         get
         {
            //return (1.0 / 297);
             return (1.0 / 298.257222101);
             
         }
      }

      public override GPoint FromLatLngToPixel(double lat, double lng, int zoom)
      {
         GPoint ret = GPoint.Empty;

         lat = Clip(lat, MinLatitude, MaxLatitude);
         lng = Clip(lng, MinLongitude, MaxLongitude);

         double[] ll = new double[] { lng, lat };
         double[] z = new double[1] { 1 };
         Reproject.ReprojectPoints(ll, z, pStart, pEnd, 0, 1);

         double res = rez[zoom];   
         var s = GetTileMatrixSizePixel(zoom);

          double test = Math.Floor(ll[0]);
         ret.X = (long)Math.Floor((ll[0] - OriginX) / res);
         ret.Y = s.Height - (long)Math.Floor((ll[1] - OriginY) / res);

         return ret;
      }

      readonly ProjectionInfo pStart = KnownCoordinateSystems.Geographic.World.WGS1984;
      readonly ProjectionInfo pEnd = ProjectionInfo.FromProj4String("+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
       
      public override PointLatLng FromPixelToLatLng(long x, long y, int zoom)
      {

         PointLatLng ret = PointLatLng.Empty;

         double res = rez[zoom];   
         var s = GetTileMatrixSizePixel(zoom);

         double[] ll = new double[] { (x * res) + OriginX, ((s.Height - y) * res) + OriginY };
         double[] z = new double[1] { 1 };
         Reproject.ReprojectPoints(ll, z, pEnd, pStart, 0, 1);
         

         ret.Lat = Clip(ll[1], MinLatitude, MaxLatitude);
         ret.Lng = Clip(ll[0], MinLongitude, MaxLongitude);

         return ret;
      }


      //GetCapabilities:
      //http://kortforsyningen.kms.dk/topo_skaermkort?request=GetCapabilities&service=WMTS&version=1.0.0
      
      static double[] rez = new double[] { 1638.40, 819.20, 409.60, 204.80, 102.40, 51.20, 25.60, 12.80, 6.40, 3.20, 1.60 ,0.80 };
      

      
      public override double GetGroundResolution(int zoom, double latitude)
      {
         return rez[zoom];
      }        
      
      public override GSize GetTileMatrixMinXY(int zoom)
      {
         double tileWorldUnits = rez[zoom] * tileSize.Width;

         var firstCol = (int)Math.Floor((MinX - OriginX) / tileWorldUnits);
         var firstRow = (int)Math.Floor((MinY - OriginY) / tileWorldUnits);

         return new GSize(firstCol, firstRow);
         
      }

      public override GSize GetTileMatrixMaxXY(int zoom)
      {
         double tileWorldUnits = rez[zoom] * tileSize.Width;

         var lastCol = (int)Math.Ceiling((MaxX - OriginX) / tileWorldUnits);
         var lastRow = (int)Math.Ceiling((MaxY - OriginY) / tileWorldUnits);

         return new GSize(lastCol-1, lastRow-1);
      }
   }

Reviewed: 1.6 - Power (Sep 25, 2014)

$
0
0
Rated 5 Stars (out of 5) - Just awesome!!!

New Post: Marker shadow

$
0
0
Hi,

I have created my own custom image markers, and all works well with the shadow50.png shadow graphic. However when I replace shadow50.png with my own shadow png using a different shape, it is not displayed. The new png is the same size as shadow50.png, also with transparency.

Is there a trick for creating the shadow? Special format?

Thanks,
Jim400

New Post: GMapMarker double click event

$
0
0
Hello

The GMapCoontrol doesn't have event OnMarkerDoubleClick
when i am trying to implement double click using a timer (as was suggested here once) i am having a problem since when performing fast double click on a marker the second click don't even raise the mouse click event so i cannot check whether this is the second click in the timer period (say 500 milliseconds) or another single click.

Is there already a new way to implement marker double click event or is there any way to fix the miss hooking of the second click?

New Post: Removing markers from the Get Static

$
0
0
I am using the Get Static to save multiple screens to replace the ugly maps in Command: Modern Air Naval Operations. My problem is that every image I grab includes coords and a map scale. My knowledge of programming is very limited, so just wondering if there is an easy solution to remove these objects from the Get Static image.
Thanks!

New Post: Distance mesuering

$
0
0
Hello,
I have a simple question, is it possible to measure a distance between two (ore more) points in GMap?
Regards
woj 117

New Post: Set EmptyMapBackground to Transparent - WinForms

$
0
0
Hi all,

I tried to set the background color for the Empty Providers ("None") to Transparent but it does not work.
In fact I want to put a GMapControl on top of another control and then put the provider to Empty in order to see the control Under.

Is this possible ?

Thanks a lot

New Post: Set EmptyMapBackground to Transparent - WinForms

$
0
0
That will not work, because the control it self is not transparent. The provider, you are trying to change to transparent is simply displaying the tiles from the provider you selected.

If you want to change the control to transparent. Do it like any other control, ie. Label or textbox:


Image

New Post: Performance Increase

$
0
0
With large screens performance is a bit of issue. I believe that it can easily get better. First I believe that these settings can be used
       e.Graphics.CompositingMode = CompositingMode.SourceCopy;
       e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
If you dont stretch tiles NearestNeighbor is fine even with stretching not all would notice any difference. Also sourcecopy is very fast if you dont have transparency at tiles which is the case most of the time I guess. Finnally DrawImage() Bitmap should be used not Image . It has great performance benefits
Here is what I use for my application (irrelevant).
With these optimizations I draw a 1920x1000 image within 1ms .

using (Bitmap oldBmp = new Bitmap(String.Format(path, i)))
            using (Bitmap newBmp = new Bitmap(oldBmp))
            {
                cache.Add(newBmp.Clone(new Rectangle(0, 0, newBmp.Width, newBmp.Height), PixelFormat.Format32bppPArgb));
            }
Quick proof
Image

New Post: How to make a map legend; Please guide me...

$
0
0
Hi,
Please let me know how to make a map legend. I'm working in Windows Forms. When I render a marker onto a map, it moves with mapdrag/zoom. But when I override OnPainOverlays, I have a System.Drawing.Graphics object and cannot get to the markers, that are GMarkerGoogleType objects. How do I stick a static marker in a corner of my map? Or maybe I'm not approaching the whole issue correctly?

Any help is greatly appreciated. I just cannot visualize my solution. Anyone, please guide me in plain English, I don't necessarily need code but it would be nice.

Thank you,

New Post: Set EmptyMapBackground to Transparent - WinForms

New Post: How to make a map legend; Please guide me...


New Post: Help needed for new mapprovider and projection

$
0
0
Hi, i took some interest in getting this to work, So when i download the fork and insert your code, i get this error:
GetImageFrom: System.Net.WebException: Fjernserveren returnerede en fejl: (500) Intern serverfejl.
   ved System.Net.HttpWebRequest.GetResponse()
   ved GMap.NET.MapProviders.GMapProvider.GetTileImageUsingHttp(String url) i d:\Windows\Documents and Settings\Downloads\greatmaps-2c5b97192449\forks_radioman_buenosaires_2c5b97192449\GMap.NET.Core\GMap.NET.MapProviders\GMapProvider.cs:linje 379
   ved Demo.WindowsForms.denmarkWMTSProvider.GetTileImage(GPoint pos, Int32 zoom) i d:\Windows\Documents and Settings\Downloads\greatmaps-2c5b97192449\forks_radioman_buenosaires_2c5b97192449\Demo.WindowsForms\Source\Program.cs:linje 108
   ved GMap.NET.GMaps.GetImageFrom(GMapProvider provider, GPoint pos, Int32 zoom, Exception& result) i d:\Windows\Documents and Settings\Downloads\greatmaps-2c5b97192449\forks_radioman_buenosaires_2c5b97192449\GMap.NET.Core\GMap.NET\GMaps.cs:linje 692
So my question to you is, Can you check if its even donloading any tiles?

in your custom provider, replace this to get the heights of the tiles:
        public override PureImage GetTileImage(GPoint pos, int zoom)
        {
            string url = MakeTileImageUrl(pos, zoom, LanguageStr);
            var tmp = GetTileImageUsingHttp(url);

            Bitmap img = new Bitmap(tmp.Data);
            Console.WriteLine("H:{0}, W:{1}", img.Height, img.Width);

            return tmp;
        }
If you can still get the tiles, and it is somehow me, who is doing something wrong. If you want to change the size of the tiles, you can use the pureimage stream to generate a bitmap. Change the size and convert it back into pure image.

heres how it could be done. Again, i use GetTileImage, and this code is not tested. Its from the top of my head:
public override PureImage GetTileImage(GPoint pos, int zoom)
        {
            string url = MakeTileImageUrl(pos, zoom, LanguageStr);
            var tmp = GetTileImageUsingHttp(url); // Place tile in Temp varible.

            Bitmap imgBitmap = new Bitmap(tmp.Data); // Convert the pureimage datastream to bitmap so we can work with it.
            Console.WriteLine("H:{0}, W:{1}", imgBitmap.Height, imgBitmap.Width); // Debug - Are we getting the tile? what size is it ?
            Bitmap result = new Bitmap(256, 256); // cant remember if the target size is 255 or 256

            using (Graphics g = Graphics.FromImage(result)) // Convert the size
            {
                g.DrawImage(imgBitmap, 0, 0, 256, 256);
            }
            var editedTile = result; // The convertedTile

            //Change bitmap to Pureimage
            var stream = new MemoryStream(); // Create stream to hold the bitmap
            editedTile.Save(stream, ImageFormat.Png); // Save the bitmap into stream
            stream.Position = 0L;
            PureImage pureImage = TileImageProxy.FromStream(stream); // Change Stream to Pureimg
            pureImage.Data = stream; // place the stream into PureImage Data

            return pureImage; // Return
        }
Edit: I realise its not the prettiest code. But iam sure you get the point of, what iam trying to do here.

New Post: How to make a map legend; Please guide me...

$
0
0
I can think of a fix with overriding OnPainOverlays function, but how do I convert GMarkerGoogleType object to bitmap? Is there such aside from creating JPGs myself with gimp or something??

New Post: Performance Increase

$
0
0
Where is your code supposed to go exactly?

Created Unassigned: issue with RectLatLng Union [16105]

$
0
0
Hello

It seems that union of two RectLatLng rectangle givesa wrong result and invert Lat / Lng

Any comment about this ?
Thanks for any advice

New Post: Performance Increase

$
0
0
Where tiles are drawn.However the bitmap conversion is more important
Viewing all 3384 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>