Skip to content

Commit

Permalink
Updated tile addressing for all Czech map providers (mapy.cz).
Browse files Browse the repository at this point in the history
Added 2 map providers (CzechTuristWinterMapProvider, CzechGeographicMapProvider).
  • Loading branch information
aconcagua21 committed Jun 6, 2016
1 parent 8a6e6d1 commit 21857fa
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 33 deletions.
2 changes: 2 additions & 0 deletions GMap.NET.Core/GMap.NET.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
<Compile Include="GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Street_MapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Terrain_Base_MapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\ArcGIS\ArcGIS_World_Topo_MapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechGeographicMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Czech\CzechTuristWinterMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\CloudMadeMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\SwedenMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\WikiMapiaMapProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
namespace GMap.NET.MapProviders
{
using System;

/// <summary>
/// CzechTuristMap provider, http://www.mapy.cz/
/// </summary>
public class CzechGeographicMapProvider : CzechMapProviderBase
{
public static readonly CzechGeographicMapProvider Instance;

CzechGeographicMapProvider()
{
}

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

#region GMapProvider Members

readonly Guid id = new Guid("{44E5E6D5-DC75-4909-A5CB-6BAFB0CAC54F}");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechGeographicMap";
public override string Name
{
get
{
return name;
}
}

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)
{
// http://m3.mapserver.mapy.czzemepis-m/14-8802-5528

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/zemepis-m/{1}-{2}-{3}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class CzechHistoryMapProvider : CzechMapProviderBase

CzechHistoryMapProvider()
{
Area = new RectLatLng(51.2024819920053, 11.8401353319027, 7.22833716731277, 2.78312271922872);
MaxZoom = 15;
}

static CzechHistoryMapProvider()
Expand Down Expand Up @@ -63,14 +65,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://m4.mapserver.mapy.cz/army2/9_7d00000_8080000
// http://m3.mapserver.mapy.cz/army2-m/14-8802-5528

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/army2/{1}_{2:x7}_{3:x7}";
static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/army2-m/{1}-{2}-{3}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://m2.mapserver.mapy.cz/hybrid/9_7d00000_7b80000
// http://m3.mapserver.mapy.cz/hybrid-m/14-8802-5528

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/hybrid/{1}_{2:x7}_{3:x7}";
static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/hybrid-m/{1}-{2}-{3}";
}
}
15 changes: 6 additions & 9 deletions GMap.NET.Core/GMap.NET.MapProviders/Czech/CzechMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class CzechMapProviderBase : GMapProvider
public CzechMapProviderBase()
{
RefererUrl = "http://www.mapy.cz/";
Area = new RectLatLng(51.2024819920053, 11.8401353319027, 7.22833716731277, 2.78312271922872);
//Area = new RectLatLng(51.2024819920053, 11.8401353319027, 7.22833716731277, 2.78312271922872);
}

#region GMapProvider Members
Expand All @@ -33,7 +33,7 @@ public override PureProjection Projection
{
get
{
return MapyCZProjection.Instance;
return MercatorProjection.Instance;
}
}

Expand Down Expand Up @@ -104,15 +104,12 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// ['base','ophoto','turist','army2']
// http://m1.mapserver.mapy.cz/base-n/3_8000000_8000000
// ['base-m','ophoto-m','turist-m','army2-m']
// http://m3.mapserver.mapy.cz/base-m/14-8802-5528

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/base-n/{1}_{2:x7}_{3:x7}";
static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/base-m/{1}-{2}-{3}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
//http://m3.mapserver.mapy.cz/ophoto/9_7a80000_7a80000
// http://m3.mapserver.mapy.cz/ophoto-m/14-8802-5528

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/ophoto/{1}_{2:x7}_{3:x7}";
static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/ophoto-m/{1}-{2}-{3}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://m1.mapserver.mapy.cz/turist/3_8000000_8000000
// http://m3.mapserver.mapy.cz/wtourist-m/14-8802-5528

long xx = pos.X << (28 - zoom);
long yy = ((((long)Math.Pow(2.0, (double)zoom)) - 1) - pos.Y) << (28 - zoom);

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, xx, yy);
return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/turist/{1}_{2:x7}_{3:x7}";
static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/wturist-m/{1}-{2}-{3}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

namespace GMap.NET.MapProviders
{
using System;

/// <summary>
/// CzechTuristMap provider, http://www.mapy.cz/
/// </summary>
public class CzechTuristWinterMapProvider : CzechMapProviderBase
{
public static readonly CzechTuristWinterMapProvider Instance;

CzechTuristWinterMapProvider()
{
}

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

#region GMapProvider Members

readonly Guid id = new Guid("1A2C354A-BF73-42AC-92E5-90DECE204F11");
public override Guid Id
{
get
{
return id;
}
}

readonly string name = "CzechTuristWinterMap";
public override string Name
{
get
{
return name;
}
}

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)
{
// http://m3.mapserver.mapy.cz/wturist_winter-m/14-8802-5528

return string.Format(UrlFormat, GetServerNum(pos, 3) + 1, zoom, pos.X, pos.Y);
}

static readonly string UrlFormat = "http://m{0}.mapserver.mapy.cz/wturist_winter-m/{1}-{2}-{3}";
}
}
2 changes: 2 additions & 0 deletions GMap.NET.Core/GMap.NET.MapProviders/GMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ static GMapProviders()
public static readonly CzechSatelliteMapProvider CzechSatelliteMap = CzechSatelliteMapProvider.Instance;
public static readonly CzechHybridMapProvider CzechHybridMap = CzechHybridMapProvider.Instance;
public static readonly CzechTuristMapProvider CzechTuristMap = CzechTuristMapProvider.Instance;
public static readonly CzechTuristWinterMapProvider CzechTuristWinterMap = CzechTuristWinterMapProvider.Instance;
public static readonly CzechHistoryMapProvider CzechHistoryMap = CzechHistoryMapProvider.Instance;
public static readonly CzechGeographicMapProvider CzechGeographicMap = CzechGeographicMapProvider.Instance;

public static readonly ArcGIS_Imagery_World_2D_MapProvider ArcGIS_Imagery_World_2D_Map = ArcGIS_Imagery_World_2D_MapProvider.Instance;
public static readonly ArcGIS_ShadedRelief_World_2D_MapProvider ArcGIS_ShadedRelief_World_2D_Map = ArcGIS_ShadedRelief_World_2D_MapProvider.Instance;
Expand Down

0 comments on commit 21857fa

Please sign in to comment.