Skip to content

Commit

Permalink
GMap.NET.Core: updated coogle url format & versions
Browse files Browse the repository at this point in the history
  • Loading branch information
radioman committed Dec 29, 2015
1 parent 5f95898 commit 3250497
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public BingMapProviderBase()
Copyright = string.Format("©{0} Microsoft Corporation, ©{0} NAVTEQ, ©{0} Image courtesy of NASA", DateTime.Today.Year);
}

public string Version = "3467";
public string Version = "4810";

/// <summary>
/// Bing Maps Customer Identification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static GoogleHybridMapProvider()
Instance = new GoogleHybridMapProvider();
}

public string Version = "h@298000000";
public string Version = "h@333000000";

#region GMapProvider Members

Expand Down Expand Up @@ -74,6 +74,6 @@ string MakeTileImageUrl(GPoint pos, int zoom, string language)

static readonly string UrlFormatServer = "mt";
static readonly string UrlFormatRequest = "vt";
static readonly string UrlFormat = "http://{0}{1}.{10}/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
static readonly string UrlFormat = "http://{0}{1}.{10}/maps/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
}
}
37 changes: 11 additions & 26 deletions GMap.NET.Core/GMap.NET.MapProviders/Google/GoogleMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public override void OnInitialized()
if (!string.IsNullOrEmpty(html))
{
#region -- match versions --
Regex reg = new Regex(string.Format(@"https?://mts?\d.{0}/vt\?lyrs=m@(\d*)", Server), RegexOptions.IgnoreCase);
Regex reg = new Regex(string.Format(@"https?://mts?\d.{0}/maps/vt\?lyrs=m@(\d*)", Server), RegexOptions.IgnoreCase);
Match mat = reg.Match(html);
if (mat.Success)
{
Expand All @@ -126,31 +126,16 @@ public override void OnInitialized()

GMapProviders.GoogleMap.Version = ver;
GMapProviders.GoogleChinaMap.Version = ver;

string verh = string.Format("h@{0}", gc [1].Value);
string oldh = GMapProviders.GoogleHybridMap.Version;

GMapProviders.GoogleHybridMap.Version = verh;
GMapProviders.GoogleChinaHybridMap.Version = verh;
#if DEBUG
Debug.WriteLine("GMapProviders.GoogleMap.Version: " + ver + ", " + (ver == old ? "OK" : "old: " + old + ", consider updating source"));
if (Debugger.IsAttached && ver != old)
{
Thread.Sleep(1111);
}
#endif
}
}
Debug.WriteLine("GMapProviders.GoogleHybridMap.Version: " + verh + ", " + (verh == oldh ? "OK" : "old: " + oldh + ", consider updating source"));

reg = new Regex(string.Format(@"https?://mts?\d.{0}/vt\?lyrs=h@(\d*)", Server), RegexOptions.IgnoreCase);
mat = reg.Match(html);
if (mat.Success)
{
GroupCollection gc = mat.Groups;
int count = gc.Count;
if (count > 0)
{
string ver = string.Format("h@{0}", gc [1].Value);
string old = GMapProviders.GoogleHybridMap.Version;

GMapProviders.GoogleHybridMap.Version = ver;
GMapProviders.GoogleChinaHybridMap.Version = ver;
#if DEBUG
Debug.WriteLine("GMapProviders.GoogleHybridMap.Version: " + ver + ", " + (ver == old ? "OK" : "old: " + old + ", consider updating source"));
if (Debugger.IsAttached && ver != old)
{
Thread.Sleep(1111);
Expand Down Expand Up @@ -183,7 +168,7 @@ public override void OnInitialized()
}
}

reg = new Regex(string.Format(@"https?://mts?\d.{0}/vt\?lyrs=t@(\d*),r@(\d*)", Server), RegexOptions.IgnoreCase);
reg = new Regex(string.Format(@"https?://mts?\d.{0}/maps/vt\?lyrs=t@(\d*),r@(\d*)", Server), RegexOptions.IgnoreCase);
mat = reg.Match(html);
if (mat.Success)
{
Expand Down Expand Up @@ -2159,7 +2144,7 @@ static GoogleMapProvider()
Instance = new GoogleMapProvider();
}

public string Version = "m@318000000";
public string Version = "m@333000000";

#region GMapProvider Members

Expand Down Expand Up @@ -2201,6 +2186,6 @@ string MakeTileImageUrl(GPoint pos, int zoom, string language)

static readonly string UrlFormatServer = "mt";
static readonly string UrlFormatRequest = "vt";
static readonly string UrlFormat = "http://{0}{1}.{10}/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
static readonly string UrlFormat = "http://{0}{1}.{10}/maps/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static GoogleSatelliteMapProvider()
Instance = new GoogleSatelliteMapProvider();
}

public string Version = "181";
public string Version = "192";

#region GMapProvider Members

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static GoogleTerrainMapProvider()
Instance = new GoogleTerrainMapProvider();
}

public string Version = "t@132,r@318000000";
public string Version = "t@132,r@333000000";

#region GMapProvider Members

Expand Down Expand Up @@ -61,6 +61,6 @@ string MakeTileImageUrl(GPoint pos, int zoom, string language)

static readonly string UrlFormatServer = "mt";
static readonly string UrlFormatRequest = "vt";
static readonly string UrlFormat = "http://{0}{1}.{10}/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
static readonly string UrlFormat = "http://{0}{1}.{10}/maps/{2}/lyrs={3}&hl={4}&x={5}{6}&y={7}&z={8}&s={9}";
}
}

0 comments on commit 3250497

Please sign in to comment.