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

New Post: Cache gets mixed up

$
0
0
Thank you for the quick response!

It is not clear to me why the tiles get mixed up. Please explain.

I need multiple instances of the same provider.
Can I use something like this to fix the problem.
In the GmapProvider.cs code:

DbId in my case is public and is set from mGmapControl.MapProvider.DbId = ...


public override Guid Id
  {
     get
     {
         return new Guid(string.Format("D7287DA0-A7FF-405F-8166-{0}", ("000000000000" + DbId.ToString()).Substring(DbId.ToString().Length - 1, 12)));
     }
  }



New Post: Cache gets mixed up

$
0
0
you don't need multiply instances of the same provider

New Post: Cache gets mixed up

$
0
0
You're right :)

The situation is I have to switch between geographic maps like open street map and maps created from drawings.
I use Maperative to generate the tiles. Works great :)
So I created a CustomMapProvider for my own maps.

This class has a TileServerUrl property to switch between maps of this CustomMapProvider type.
Set the TileServerUrl property to http://localhost/MyMaps/MapOne/ http://localhost/MyMaps/MapTwo/ etc..
Had to add public string TileServerUrl = string.Empty; to the GmapProvider class.
I use the Guid override code below now not in the GmapProvider class but in my own CustomMapProvider class.
Seems to solve the mix up. I'm still testing.
  public override Guid Id
  {
      get
      {
          return new Guid(string.Format("D7287DA0-A7FF-405F-8166-{0}", ("000000000000" + DbId.ToString()).Substring(DbId.ToString().Length - 1, 12)));  // id;
      }
  }
Custom tile image url format:
  string MakeTileImageUrl(GPoint pos, int zoom, string language)
  {
      string tileUrl = string.Format(UrlFormat, TileServerUrl, zoom, pos.X, pos.Y, baseFormatExt);
      return tileUrl; 
  }

  static readonly string baseFormatExt = ".png";
  static readonly string UrlFormat = "http://{0}/{1}/{2}/{3}{4}";

New Post: Cache gets mixed up

$
0
0
DbId is generated using Guid id, so use some other parameter, like hash of name or something...

..and you don't need multiply instances of the same provider, but i mean for one map, for different maps you need multiply instances of usually different providers, but in your case it can be different instances of the same provider with different parameters, therefore guids will be different and DbId will be automaticaly different too

simple logic:
CustomProvider : GMapProvider
{
    CustomProvider(string server, string myMapName)
    {
       this.myMapName = myMapName;
    }

    public override Guid Id
    {
      get
      {
          return new Guid(string.Format("D7287DA0-A7FF-405F-8166-{0}", Hash(myMapName));
      }
}

var p1 = new CustomProvider("localhost", "MapOne");
var p2 = new CustomProvider("localhost", "MapTwo");
var p3 = new CustomProvider("localhost", "MapThree");

lisbox.items = new [] {p1, p2, p3}

OnListBoxItemchanged
{
  mGmapControl.MapProvider = currentitem;
}

New Post: Cache gets mixed up

$
0
0
Thanx! Got it :)

Gmap is a wonderfull piece of work!

New Post: Google API v3 Support

$
0
0
Hi there,

I have observed and used this great project now for a while. It seems that development on the Google API (v3) has been halted - probably due to the fact that the project has run into trouble with Googles Terms. Especially the GeoCoding and Routing (Directions) API are very important to me.

Using the new API (v3) should actually fit into Googles Terms - and with Enterprise Support, the same API can also be used for large scale Enterprise Applications. (At least they have now examples of how to use their API with Java, C# and Co on their very own page)

I actually wanted to implement the new v3 API now myself, but I have stumbled across this great library here (https://github.com/maximn/google-maps) which implements the Google Maps API v3, including Enterprise support. So there is no need to reinvent the wheel.

So why not integrate this project into GMaps.NET? I will integrate it in my copy of GMap.NET - and would gladly share the code if there is a possibility to fork it on Git/GitHub. I think the only caveat will be the integration of the Cache, the rest will be simply wrapping the results to the GMap.NET objects.

Best,
IsNull

New Post: Windows 8 Metro support

$
0
0
Is it possible to run GMap in a windows 8 app store/metro?

New Post: Google API v3 Support


New Post: Windows 8 Metro support

New Post: How can I change marker image on a marker click

$
0
0
Let say I have 200 markers with custom images on the Gmap. I click one of the marker to signal a 'status' change on this marker/position. I want to be able to just change image and tooltip on the clicked marker.

I can catch the marker click but how to change marker image and tooltip..

New Post: Country Boundaries

$
0
0
google geocoder returns:
                  //    <ExtendedData>
                  //      <LatLonBox north="54.8616279" south="54.4663633" east="25.4839269" west="24.9688846" />
                  //    </ExtendedData>
but current code doesn't use/parse it, you have to modify it, or make extended function which include this functionality

New Post: Country Boundaries

$
0
0
Where can i get the geocoder?

Can i use the following code?
GeocodingProvider a = GMap.NET.MapProviders.GoogleMapProvider.Instance as GeocodingProvider;

New Post: Country Boundaries

New Post: Country Boundaries

$
0
0
could you give an example on how to get data from the geocoder? Have tried many things and don't think i have quite understood how.

New Post: Street View + Orientation?

$
0
0
Is it possible to use street view with GMAP.net and is it possible to get the Orientation + Positioning information?

New Post: How can I change marker image on a marker click

$
0
0
Thank you Radioman !

And for you who want to acomplish the same with VB here is my code.

Private Sub GMap1_OnMarkerClick(ByVal item As GMap.NET.WindowsForms.GMapMarker, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GMap1.OnMarkerClick
            Dim customMarker = TryCast(item, GMapMarkerImage)
            customMarker.markerimage = My.Resources.floodg
            customMarker.tooltiptext = "Rapporterad tömd"

            GMap1.Invalidate()
End Sub


Public Class GMapMarkerImage
Inherits GMap.NET.WindowsForms.GMapMarker
Private img As Image

''' <summary>
''' The image to display as a marker.
''' </summary>
Public Property MarkerImage() As Image
    Get
        Return img
    End Get
    Set(ByVal value As Image)
        img = value
    End Set
End Property


Public Sub New(ByVal p As PointLatLng, ByVal image As Image)
    MyBase.New(p)
    img = image
    Size = img.Size
    Offset = New System.Drawing.Point(-Size.Width / 2, -Size.Height / 2)
End Sub

Public Overrides Sub OnRender(ByVal g As Graphics)
    g.DrawImage(img, LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height)
End Sub
End Class

New Post: GMap1.MapProvider = GMapProviders.GoogleMap

$
0
0
How Can I set GoogleMap as default map on startup in form load ?



GMaps.Instance.UseRouteCache = True
    GMaps.Instance.UseGeocoderCache = True
    GMaps.Instance.UsePlacemarkCache = True
    GMaps.Instance.Mode = AccessMode.ServerAndCache
    GMap1.MapProvider = GMapProviders.GoogleMap

    'Lägg till ett layer

    GPSOVERLAY = New GMapOverlay(GMap1, " GPSOVERLAY")
    Layer_layers = New GMapOverlay(GMap1, "Layer_layers")
    GMap1.MinZoom = 1
    GMap1.MaxZoom = 17
    GMap1.Zoom = 9
    GMap1.SetCurrentPositionByKeywords("Stockholm, Sweden")
    GMap1.Dock = System.Windows.Forms.DockStyle.Fill
    GMap1.DragButton = Windows.Forms.MouseButtons.Left
    GMap1.CanDragMap = True
    GMap1.Update()

New Post: Street View + Orientation?

New Post: GMap1.MapProvider = GMapProviders.GoogleMap

New Post: ASP.Net support

$
0
0
I've created a desktop application using GMaps.Net and have now been asked to create a web based version of my app.

I have no experience of web development, is it possible to use GMaps.Net in an ASP.net application with things like overlays, scrolling/zooming as in my desptop app? If so are there any examples anywhere that could help me get started?

James
Viewing all 3384 articles
Browse latest View live


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