Skip to content

Commit

Permalink
GMap.NET.Core: updated some map providers
Browse files Browse the repository at this point in the history
  • Loading branch information
radioman committed May 1, 2015
1 parent 7bc9040 commit 21c89d0
Show file tree
Hide file tree
Showing 16 changed files with 896 additions and 449 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,7 @@
<Compile Include="GMap.NET.MapProviders\Etc\MapBenderWMSProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\SpainMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Etc\LatviaMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Lithuania\LithuaniaReliefMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Lithuania\LithuaniaHybridOldMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Lithuania\LithuaniaHybridMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\Lithuania\LithuaniaOrtoFotoOldMapProvider.cs" />
Expand Down Expand Up @@ -246,6 +247,7 @@
<Compile Include="GMap.NET.MapProviders\OpenStreetMap\OpenStreetOsmProvider.cs" />
<Compile Include="GMap.NET.MapProviders\OpenStreetMap\OpenStreetMapProvider.cs" />
<Compile Include="GMap.NET.MapProviders\GMapProvider.cs" />
<Compile Include="GMap.NET.Projections\MapsLTReliefProjection.cs" />
<Compile Include="GMap.NET.Projections\PlateCarreeProjectionDarbAe.cs" />
<Compile Include="GMap.NET\GDirections.cs" />
<Compile Include="GMap.NET\DirectionsProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public IEnumerable<GDirections> GetDirections(out DirectionsStatusCode status, P
/// <param name="sensor"></param>
/// <param name="metric"></param>
/// <returns></returns>
public DirectionsStatusCode GetDirections(out GDirections direction, PointLatLng start, IEnumerable<PointLatLng> wayPoints, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
public DirectionsStatusCode GetDirections(out GDirections direction, PointLatLng start, IEnumerable<PointLatLng> wayPoints, PointLatLng end, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
throw new NotImplementedException();
}
Expand All @@ -305,7 +305,7 @@ public DirectionsStatusCode GetDirections(out GDirections direction, PointLatLng
/// <param name="sensor"></param>
/// <param name="metric"></param>
/// <returns></returns>
public DirectionsStatusCode GetDirections(out GDirections direction, string start, IEnumerable<string> wayPoints, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
public DirectionsStatusCode GetDirections(out GDirections direction, string start, IEnumerable<string> wayPoints, string end, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
throw new NotImplementedException();
}
Expand Down
8 changes: 5 additions & 3 deletions GMap.NET.Core/GMap.NET.MapProviders/Etc/LatviaMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public abstract class LatviaMapProviderBase : GMapProvider
{
public LatviaMapProviderBase()
{
RefererUrl = "http://www.ikarte.lv/map/default.aspx?lang=en";
RefererUrl = "http://www.ikarte.lv/default.aspx?lang=en";
Copyright = string.Format("©{0} Hnit-Baltic - Map data ©{0} LR Valsts zemes dieniests, SIA Envirotech", DateTime.Today.Year);
MaxZoom = 11;
Area = new RectLatLng(58.0794870805093, 20.3286067123543, 7.90883164336887, 2.506129113082);
Expand Down Expand Up @@ -106,12 +106,14 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://www.maps.lt/cache/ikartelv/map/_alllayers/L03/R00000037/C00000053.png
// http://www.maps.lt/cache/ikartelv/map/_alllayers/L03/R00000037/C00000053.png
// http://www.maps.lt/arcgiscache/ikartelv/map/_alllayers/L02/R0000001c/C0000002a.png
// http://services.maps.lt/mapsk_services/rest/services/ikartelv/MapServer/tile/5/271/416.png?cl=ikrlv

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

static readonly string UrlFormat = "http://www.maps.lt/arcgiscache/ikartelv/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
static readonly string UrlFormat = "http://services.maps.lt/mapsk_services/rest/services/ikartelv/MapServer/tile/{0}/{1}/{2}.png?cl=ikrlv";
//static readonly string UrlFormat = "http://www.maps.lt/arcgiscache/ikartelv/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
}
}
1 change: 1 addition & 0 deletions GMap.NET.Core/GMap.NET.MapProviders/GMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static GMapProviders()
public static readonly YandexHybridMapProvider YandexHybridMap = YandexHybridMapProvider.Instance;

public static readonly LithuaniaMapProvider LithuaniaMap = LithuaniaMapProvider.Instance;
public static readonly LithuaniaReliefMapProvider LithuaniaReliefMap = LithuaniaReliefMapProvider.Instance;
public static readonly Lithuania3dMapProvider Lithuania3dMap = Lithuania3dMapProvider.Instance;
public static readonly LithuaniaOrtoFotoMapProvider LithuaniaOrtoFotoMap = LithuaniaOrtoFotoMapProvider.Instance;
public static readonly LithuaniaOrtoFotoOldMapProvider LithuaniaOrtoFotoOldMap = LithuaniaOrtoFotoOldMapProvider.Instance;
Expand Down
20 changes: 10 additions & 10 deletions GMap.NET.Core/GMap.NET.MapProviders/Google/GoogleMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,14 +1430,14 @@ public IEnumerable<GDirections> GetDirections(out DirectionsStatusCode status, P
throw new NotImplementedException();
}

public DirectionsStatusCode GetDirections(out GDirections direction, PointLatLng start, IEnumerable<PointLatLng> wayPoints, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
public DirectionsStatusCode GetDirections(out GDirections direction, PointLatLng start, IEnumerable<PointLatLng> wayPoints, PointLatLng end, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
return GetDirectionsUrl(MakeDirectionsUrl(start, wayPoints, LanguageStr, avoidHighways, avoidTolls, walkingMode, sensor, metric), out direction);
return GetDirectionsUrl(MakeDirectionsUrl(start, wayPoints, end, LanguageStr, avoidHighways, avoidTolls, walkingMode, sensor, metric), out direction);
}

public DirectionsStatusCode GetDirections(out GDirections direction, string start, IEnumerable<string> wayPoints, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
public DirectionsStatusCode GetDirections(out GDirections direction, string start, IEnumerable<string> wayPoints, string end, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
return GetDirectionsUrl(MakeDirectionsUrl(start, wayPoints, LanguageStr, avoidHighways, avoidTolls, walkingMode, sensor, metric), out direction);
return GetDirectionsUrl(MakeDirectionsUrl(start, wayPoints, end, LanguageStr, avoidHighways, avoidTolls, walkingMode, sensor, metric), out direction);
}

#region -- internals --
Expand All @@ -1462,7 +1462,7 @@ string MakeDirectionsUrl(string start, string end, string language, bool avoidHi
return string.Format(DirectionUrlFormatStr, start.Replace(' ', '+'), end.Replace(' ', '+'), sensor.ToString().ToLower(), language, av, mt, wk, ServerAPIs);
}

string MakeDirectionsUrl(PointLatLng start, IEnumerable<PointLatLng> wayPoints, string language, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
string MakeDirectionsUrl(PointLatLng start, IEnumerable<PointLatLng> wayPoints, PointLatLng end, string language, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
string av = (avoidHighways ? "&avoid=highways" : string.Empty) + (avoidTolls ? "&avoid=tolls" : string.Empty); // 6
string mt = "&units=" + (metric ? "metric" : "imperial"); // 7
Expand All @@ -1475,10 +1475,10 @@ string MakeDirectionsUrl(PointLatLng start, IEnumerable<PointLatLng> wayPoints,
wpLatLng += string.Format(CultureInfo.InvariantCulture, i++ == 0 ? "{0},{1}" : "|{0},{1}", wp.Lat, wp.Lng);
}

return string.Format(CultureInfo.InvariantCulture, DirectionUrlFormatWaypoint, start.Lat, start.Lng, wpLatLng, sensor.ToString().ToLower(), language, av, mt, wk, ServerAPIs);
return string.Format(CultureInfo.InvariantCulture, DirectionUrlFormatWaypoint, start.Lat, start.Lng, wpLatLng, sensor.ToString().ToLower(), language, av, mt, wk, ServerAPIs, end.Lat, end.Lng);
}

string MakeDirectionsUrl(string start, IEnumerable<string> wayPoints, string language, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
string MakeDirectionsUrl(string start, IEnumerable<string> wayPoints, string end, string language, bool avoidHighways, bool avoidTolls, bool walkingMode, bool sensor, bool metric)
{
string av = (avoidHighways ? "&avoid=highways" : string.Empty) + (avoidTolls ? "&avoid=tolls" : string.Empty); // 6
string mt = "&units=" + (metric ? "metric" : "imperial"); // 7
Expand All @@ -1491,7 +1491,7 @@ string MakeDirectionsUrl(string start, IEnumerable<string> wayPoints, string lan
wpLatLng += string.Format(CultureInfo.InvariantCulture, i++ == 0 ? "{0}" : "|{0}", wp.Replace(' ', '+'));
}

return string.Format(CultureInfo.InvariantCulture, DirectionUrlFormatWaypointStr, start.Replace(' ', '+'), wpLatLng, sensor.ToString().ToLower(), language, av, mt, wk, ServerAPIs);
return string.Format(CultureInfo.InvariantCulture, DirectionUrlFormatWaypointStr, start.Replace(' ', '+'), wpLatLng, sensor.ToString().ToLower(), language, av, mt, wk, ServerAPIs, end.Replace(' ', '+'));
}

DirectionsStatusCode GetDirectionsUrl(string url, out GDirections direction)
Expand Down Expand Up @@ -2076,8 +2076,8 @@ static void DecodePointsInto(List<PointLatLng> path, string encodedPath)

static readonly string DirectionUrlFormatStr = "http://maps.{7}/maps/api/directions/xml?origin={0}&destination={1}&sensor={2}&language={3}{4}{5}{6}";
static readonly string DirectionUrlFormatPoint = "http://maps.{9}/maps/api/directions/xml?origin={0},{1}&destination={2},{3}&sensor={4}&language={5}{6}{7}{8}";
static readonly string DirectionUrlFormatWaypoint = "http://maps.{8}/maps/api/directions/xml?origin={0},{1}&waypoints={2}&sensor={3}&language={4}{5}{6}{7}";
static readonly string DirectionUrlFormatWaypointStr = "http://maps.{7}/maps/api/directions/xml?origin={0}&waypoints={1}&sensor={2}&language={3}{4}{5}{6}";
static readonly string DirectionUrlFormatWaypoint = "http://maps.{8}/maps/api/directions/xml?origin={0},{1}&waypoints={2}&destination={9},{10}&sensor={3}&language={4}{5}{6}{7}";
static readonly string DirectionUrlFormatWaypointStr = "http://maps.{7}/maps/api/directions/xml?origin={0}&waypoints={1}&destination={8}&sensor={2}&language={3}{4}{5}{6}";

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
//http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/0/9/13
//return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/{0}/{1}/{2}", zoom, pos.Y, pos.X);
//http://dc1.maps.lt/cache/mapslt_ortofoto_overlay_512/map/_alllayers/L03/R0000001d/C00000029.png
// http://dc5.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L09/R000016b1/C000020e1.jpg

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

internal static readonly string UrlFormat = "http://dc1.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
internal static readonly string UrlFormat = "http://dc5.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace GMap.NET.MapProviders
using System;

/// <summary>
/// LithuaniaHybridNewMap, from 2005 data, provider
/// LithuaniaHybridOldMap, from 2010 data, provider
/// </summary>
public class LithuaniaHybridOldMapProvider : LithuaniaMapProviderBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// old stuff
// http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg
// http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13
// return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.Y, pos.X);
// http://arcgis.maps.lt/ArcGIS/rest/services/mapslt/MapServer/tile/7/1162/1684.png
// http://dc1.maps.lt/cache/mapslt_512/map/_alllayers/L03/R0000001b/C00000029.png

// http://dc1.maps.lt/cache/mapslt/map/_alllayers/L02/R0000001c/C00000029.png
// http://dc5.maps.lt/cache/mapslt/map/_alllayers/L08/R00000912/C00000d25.png

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

static readonly string UrlFormat = "http://dc1.maps.lt/cache/mapslt/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
static readonly string UrlFormat = "http://dc5.maps.lt/cache/mapslt/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// old stuff
// http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg
// http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13
// return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.Y, pos.X);
// http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001c/C00000029.jpg
// return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/{0}/{1}/{2}", zoom, pos.Y, pos.X);
// http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001d/C0000002a.jpg
// http://dc5.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L08/R00000914/C00000d28.jpg

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

static readonly string UrlFormat = "http://dc1.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg";
static readonly string UrlFormat = "http://dc5.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace GMap.NET.MapProviders
using System;

/// <summary>
/// LithuaniaOrtoFotoNewMap, from 2005 data, provider
/// LithuaniaOrtoFotoNewMap, from 2010 data, provider
/// </summary>
public class LithuaniaOrtoFotoOldMapProvider : LithuaniaMapProviderBase
{
Expand Down Expand Up @@ -50,9 +50,11 @@ public override PureImage GetTileImage(GPoint pos, int zoom)

string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://dc1.maps.lt/cache/mapslt_ortofoto_2010/map/_alllayers/L09/R000016b1/C000020e2.jpg

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

static readonly string UrlFormat = "http://dc1.maps.lt/cache/mapslt_ortofoto_2005/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg";
static readonly string UrlFormat = "http://dc1.maps.lt/cache/mapslt_ortofoto_2010/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

namespace GMap.NET.MapProviders
{
using System;
using GMap.NET.Projections;

/// <summary>
/// LithuaniaReliefMap provider, http://www.maps.lt/map/
/// </summary>
public class LithuaniaReliefMapProvider : LithuaniaMapProviderBase
{
public static readonly LithuaniaReliefMapProvider Instance;

LithuaniaReliefMapProvider()
{

}

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

#region GMapProvider Members

readonly Guid id = new Guid("85F89205-1062-4F10-B536-90CD8B2F1B7D");
public override Guid Id
{
get
{
return id;
}
}

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

public override PureProjection Projection
{
get
{
return LKS94rProjection.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)
{
// http://dc5.maps.lt/cache/mapslt_relief_vector/map/_alllayers/L09/R00001892/C000020df.jpg

return string.Format(UrlFormat, zoom, pos.Y, pos.X);
}

static readonly string UrlFormat = "http://dc5.maps.lt/cache/mapslt_relief_vector/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.png";
}
}
13 changes: 10 additions & 3 deletions GMap.NET.Core/GMap.NET.MapProviders/Yahoo/YahooMapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ static YahooMapProvider()
Instance = new YahooMapProvider();
}

public string Version = "4.3";
public string Version = "2.1";

#region GMapProvider Members

Expand Down Expand Up @@ -411,10 +411,17 @@ public override PureImage GetTileImage(GPoint pos, int zoom)
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
// http://maps1.yimg.com/hx/tl?b=1&v=4.3&.intl=en&x=12&y=7&z=7&r=1
// http://2.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/11/1169/652/256/png8?lg=EN&token=TrLJuXVK62IQk0vuXFzaig%3D%3D&app_id=eAdkWGYRoc4RfxVo0Z4B
// https://4.aerial.maps.api.here.com/maptile/2.1/maptile/newest/hybrid.day/11/1167/652/256/jpg?lg=ENG&token=TrLJuXVK62IQk0vuXFzaig%3D%3D&requestid=yahoo.prod&app_id=eAdkWGYRoc4RfxVo0Z4B
// https://4.aerial.maps.api.here.com/maptile/2.1/maptile/newest/satellite.day/13/4671/2604/256/jpg?lg=ENG&token=TrLJuXVK62IQk0vuXFzaig%3D%3D&requestid=yahoo.prod&app_id=eAdkWGYRoc4RfxVo0Z4B

return string.Format(UrlFormat, ((GetServerNum(pos, 2)) + 1), Version, language, pos.X, (((1 << zoom) >> 1) - 1 - pos.Y), (zoom + 1));
return string.Format(UrlFormat, ((GetServerNum(pos, 2)) + 1), Version, zoom, pos.X, pos.Y, language, rnd1, rnd2);
}

static readonly string UrlFormat = "http://maps{0}.yimg.com/hx/tl?v={1}&.intl={2}&x={3}&y={4}&z={5}&r=1";
string rnd1 = Guid.NewGuid().ToString("N").Substring(0, 28);
string rnd2 = Guid.NewGuid().ToString("N").Substring(0, 20);

//static readonly string UrlFormat = "http://maps{0}.yimg.com/hx/tl?v={1}&.intl={2}&x={3}&y={4}&z={5}&r=1";
static readonly string UrlFormat = "http://{0}.base.maps.api.here.com/maptile/{1}/maptile/newest/normal.day/{2}/{3}/{4}/256/png8?lg={5}&token={6}&requestid=yahoo.prod&app_id={7}";
}
}
Loading

0 comments on commit 21c89d0

Please sign in to comment.