public static bool IsMapBox(this TILE_SERVER server) { return((int)server >= 150 && (int)server < 160); }
public static bool IsAerisWeather(this TILE_SERVER server) { return(server == TILE_SERVER.AerisWeather); }
public string GetTileURL(TILE_SERVER server, TileInfo ti) { string url; subserverSeq++; if (subserverSeq > 100000) { subserverSeq = 0; } switch (_tileServer) { case TILE_SERVER.OpenStreeMap: url = "http://" + subservers[subserverSeq % 3] + ".tile.openstreetmap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenStreeMapDE: url = "http://" + subservers[subserverSeq % 3] + ".tile.openstreetmap.de/tiles/osmde/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenStreeMapHiking: url = "http://" + subservers[subserverSeq % 3] + ".tiles.wmflabs.org/hikebike/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenToner: url = "http://tile.stamen.com/toner/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenTerrain: url = "http://tile.stamen.com/terrain/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenWaterColor: url = "http://tile.stamen.com/watercolor/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoLightAll: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkAll: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoNoLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoOnlyLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkNoLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkOnlyLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.WikiMediaAtlas: url = "http://" + subservers[subserverSeq % 3] + ".tiles.wmflabs.org/bw-mapnik/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.ThunderForestLandscape: url = "http://" + subservers[subserverSeq % 3] + ".tile.thunderforest.com/landscape/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenTopoMap: url = "http://" + subservers[subserverSeq % 3] + ".tile.opentopomap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.GoogleMapsSatellite: url = "http://mt" + (subserverSeq % 4) + ".googleapis.com/vt/lyrs=y&hl=en&z=" + ti.zoomLevel + "&x=" + ti.x + "&y=" + ti.y; break; case TILE_SERVER.GoogleMapsSatelliteNoLabels: url = "http://khm" + (subserverSeq % 4) + ".googleapis.com/kh?v=865&hl=en&z=" + ti.zoomLevel + "&x=" + ti.x + "&y=" + ti.y; break; case TILE_SERVER.GoogleMapsRelief: url = "http://mt" + (subserverSeq % 4) + ".googleapis.com/vt/lyrs=t@131,r@216000000&src=app&hl=en&z=" + ti.zoomLevel + "&x=" + ti.x + "&y=" + ti.y; break; case TILE_SERVER.MapBoxSatellite: url = "https://api.mapbox.com/v4/mapbox.satellite/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxCountries: url = "https://api.mapbox.com/v4/mapbox.country-boundaries-v1/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxTraffic: url = "https://api.mapbox.com/v4/mapbox.mapbox-traffic-v1/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxIncidents: url = "https://api.mapbox.com/v4/mapbox.mapbox-incidents-v1/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxStreets: url = "https://api.mapbox.com/v4/mapbox.mapbox-streets-v8/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxTerrain: url = "https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapBoxTerrainRGB: url = "https://api.mapbox.com/v4/mapbox.terrain-rgb/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png?access_token=" + _tileServerAPIKey; break; case TILE_SERVER.MapsForFree: url = "https://maps-for-free.com/layer/relief/z" + ti.zoomLevel + "/row" + ti.y + "/" + ti.zoomLevel + "_" + ti.x + "-" + ti.y + ".jpg"; break; case TILE_SERVER.USGSSattelite: url = "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/" + ti.zoomLevel + "/" + ti.y + "/" + ti.x; break; case TILE_SERVER.Sputnik: url = "http://" + subservers[subserverSeq % 3] + ".tiles.maps.sputnik.ru/tiles/kmt2/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.AerisWeather: //https://maps[server].aerisapi.com/[client_id]_[client_key]/[type]/[zoom]/[x]/[y]/[offset].png url = "http://maps" + ((subserverSeq % 4) + 1).ToString() + ".aerisapi.com/" + _tileServerClientId + "_" + _tileServerAPIKey + "/" + _tileServerLayerTypes + "/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + "/" + _tileServerTimeOffset + ".png"; break; case TILE_SERVER.ESRITopo: url = "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/" + ti.zoomLevel + "/" + ti.y + "/" + ti.x + ".jpg"; break; case TILE_SERVER.ESRIStreets: url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/" + ti.zoomLevel + "/" + ti.y + "/" + ti.x; break; case TILE_SERVER.ESRISatellite: url = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/" + ti.zoomLevel + "/" + ti.y + "/" + ti.x + ".jpg"; break; case TILE_SERVER.ESRINationalGeoStyle: url = "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/" + ti.zoomLevel + "/" + ti.y + "/" + ti.x; break; case TILE_SERVER.Custom: StringBuilder sb = new StringBuilder(_tileServerCustomUrl); sb.Replace("$n$", subservers[subserverSeq % 3]); sb.Replace("$N$", subservers[subserverSeq % 3]); sb.Replace("$X$", ti.x.ToString()); sb.Replace("$x$", ti.x.ToString()); sb.Replace("$Y$", ti.y.ToString()); sb.Replace("$y$", ti.y.ToString()); sb.Replace("$Z$", ti.zoomLevel.ToString()); sb.Replace("$z$", ti.zoomLevel.ToString()); url = sb.ToString(); break; default: Debug.LogError("Tile server not defined: " + tileServer.ToString()); url = ""; break; } if (!server.IsMapBox() && !server.IsAerisWeather() && server != TILE_SERVER.Custom && !string.IsNullOrEmpty(_tileServerAPIKey)) { url += "?" + _tileServerAPIKey; } if (OnTileURLRequest != null) { url = OnTileURLRequest(url, server, ti.zoomLevel, ti.x, ti.y); } return(url); }
public string GetTileServerCopyrightNotice(TILE_SERVER server) { string copyright; switch (server) { case TILE_SERVER.OpenStreeMap: case TILE_SERVER.OpenStreeMapDE: case TILE_SERVER.OpenStreeMapHiking: copyright = "Map tiles © OpenStreetMap www.osm.org/copyright"; break; case TILE_SERVER.StamenToner: case TILE_SERVER.StamenTerrain: case TILE_SERVER.StamenWaterColor: copyright = "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoLightAll: case TILE_SERVER.CartoDarkAll: case TILE_SERVER.CartoNoLabels: case TILE_SERVER.CartoOnlyLabels: case TILE_SERVER.CartoDarkNoLabels: case TILE_SERVER.CartoDarkOnlyLabels: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.WikiMediaAtlas: copyright = "Map tiles © WikiMedia/Mapnik, Data © www.osm.org/copyright"; break; case TILE_SERVER.ThunderForestLandscape: copyright = "Map tiles © www.thunderforest.com, Data © www.osm.org/copyright"; break; case TILE_SERVER.OpenTopoMap: copyright = "Map tiles © OpenTopoMap, Data © www.osm.org/copyright"; break; case TILE_SERVER.GoogleMapsSatellite: case TILE_SERVER.GoogleMapsSatelliteNoLabels: case TILE_SERVER.GoogleMapsRelief: copyright = "Map tiles © Google"; break; case TILE_SERVER.MapBoxSatellite: case TILE_SERVER.MapBoxTerrain: case TILE_SERVER.MapBoxTerrainRGB: case TILE_SERVER.MapBoxCountries: case TILE_SERVER.MapBoxIncidents: case TILE_SERVER.MapBoxStreets: case TILE_SERVER.MapBoxTraffic: copyright = "Map tiles © MapBox"; break; case TILE_SERVER.Sputnik: copyright = "Map tiles © Sputnik, Data © www.osm.org/copyright"; break; case TILE_SERVER.AerisWeather: copyright = "Map tiles © Aeris Weather, www.aerisweather.com"; break; case TILE_SERVER.MapsForFree: copyright = "Map tiles © OpenStreetMap contributors"; break; case TILE_SERVER.USGSSattelite: copyright = "Map tiles © USGS, www.usgs.gov"; break; case TILE_SERVER.ESRITopo: case TILE_SERVER.ESRIStreets: case TILE_SERVER.ESRISatellite: case TILE_SERVER.ESRINationalGeoStyle: copyright = "Map tiles © ESRI"; break; case TILE_SERVER.Custom: copyright = ""; break; default: Debug.LogError("Tile server not defined: " + tileServer.ToString()); copyright = ""; break; } return(copyright); }
public string GetTileServerCopyrightNotice(TILE_SERVER server) { string copyright; switch (_tileServer) { case TILE_SERVER.OpenStreeMap: copyright = "Map tiles © OpenStreetMap www.osm.org/copyright"; break; case TILE_SERVER.OpenStreeMapDE: copyright = "Map tiles © OpenStreetMap www.osm.org/copyright"; break; case TILE_SERVER.StamenToner: copyright = "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.StamenTerrain: copyright = "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.StamenWaterColor: copyright = "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoLightAll: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoDarkAll: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoNoLabels: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoOnlyLabels: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoDarkNoLabels: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.CartoDarkOnlyLabels: copyright = "Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."; break; case TILE_SERVER.WikiMediaAtlas: copyright = "Map tiles © WikiMedia/Mapnik, Data © www.osm.org/copyright"; break; case TILE_SERVER.ThunderForestLandscape: copyright = "Map tiles © www.thunderforest.com, Data © www.osm.org/copyright"; break; case TILE_SERVER.OpenTopoMap: copyright = "Map tiles © OpenTopoMap, Data © www.osm.org/copyright"; break; case TILE_SERVER.MapBoxSatellite: copyright = "Map tiles © MapBox"; break; case TILE_SERVER.Sputnik: copyright = "Map tiles © Sputnik, Data © www.osm.org/copyright"; break; case TILE_SERVER.AerisWeather: copyright = "Map tiles © Aeris Weather, www.aerisweather.com"; break; case TILE_SERVER.Custom: copyright = ""; break; default: Debug.LogError("Tile server not defined: " + tileServer.ToString()); copyright = ""; break; } return(copyright); }
public string GetTileURL(TILE_SERVER server, TileInfo ti) { string url; string[] subservers = { "a", "b", "c" }; subserverSeq++; if (subserverSeq > 100000) { subserverSeq = 0; } switch (_tileServer) { case TILE_SERVER.OpenStreeMap: url = "http://" + subservers [subserverSeq % 3] + ".tile.openstreetmap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenStreeMapDE: url = "http://" + subservers [subserverSeq % 3] + ".tile.openstreetmap.de/tiles/osmde/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenToner: url = "http://tile.stamen.com/toner/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenTerrain: url = "http://tile.stamen.com/terrain/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenWaterColor: url = "http://tile.stamen.com/watercolor/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoLightAll: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/light_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkAll: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/dark_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoNoLabels: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/light_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoOnlyLabels: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/light_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkNoLabels: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/dark_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkOnlyLabels: url = "http://" + subservers [subserverSeq % 3] + ".basemaps.cartocdn.com/dark_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.WikiMediaAtlas: url = "http://" + subservers [subserverSeq % 3] + ".tiles.wmflabs.org/bw-mapnik/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.ThunderForestLandscape: url = "http://" + subservers [subserverSeq % 3] + ".tile.thunderforest.com/landscape/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenTopoMap: url = "http://" + subservers [subserverSeq % 3] + ".tile.opentopomap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.MapBoxSatellite: url = "http://" + subservers [subserverSeq % 3] + ".tiles.mapbox.com/v3/tmcw.map-j5fsp01s/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.Sputnik: url = "http://" + subservers [subserverSeq % 3] + ".tiles.maps.sputnik.ru/tiles/kmt2/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.AerisWeather: //https://maps[server].aerisapi.com/[client_id]_[client_key]/[type]/[zoom]/[x]/[y]/[offset].png url = "http://maps" + ((subserverSeq % 4) + 1).ToString() + ".aerisapi.com/" + _tileServerClientId + "_" + _tileServerAPIKey + "/" + _tileServerLayerTypes + "/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + "/" + _tileServerTimeOffset + ".png"; break; case TILE_SERVER.Custom: StringBuilder sb = new StringBuilder(_tileServerCustomUrl); sb.Replace("$n$", subservers [subserverSeq % 3]); sb.Replace("$N$", subservers [subserverSeq % 3]); sb.Replace("$X$", ti.x.ToString()); sb.Replace("$x$", ti.x.ToString()); sb.Replace("$Y$", ti.y.ToString()); sb.Replace("$y$", ti.y.ToString()); sb.Replace("$Z$", ti.zoomLevel.ToString()); sb.Replace("$z$", ti.zoomLevel.ToString()); url = sb.ToString(); break; default: Debug.LogError("Tile server not defined: " + tileServer.ToString()); url = ""; break; } if (_tileServer != TILE_SERVER.Custom && _tileServerAPIKey != null && _tileServerAPIKey.Length > 0) { url += "?" + _tileServerAPIKey; } return(url); }
void GetTileServerInfo(TILE_SERVER server, TileInfo ti, out string url) { string[] subservers = { "a", "b", "c" }; subserverSeq++; if (subserverSeq > 100000) { subserverSeq = 0; } switch (_tileServer) { case TILE_SERVER.OpenStreeMap: url = "http://" + subservers[subserverSeq % 3] + ".tile.openstreetmap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenStreeMapDE: url = "http://" + subservers[subserverSeq % 3] + ".tile.openstreetmap.de/tiles/osmde/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenToner: url = "http://tile.stamen.com/toner/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenTerrain: url = "http://tile.stamen.com/terrain/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.StamenWaterColor: url = "http://tile.stamen.com/watercolor/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoLightAll: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkAll: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_all/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoNoLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoOnlyLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/light_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkNoLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_nolabels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.CartoDarkOnlyLabels: url = "http://" + subservers[subserverSeq % 3] + ".basemaps.cartocdn.com/dark_only_labels/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.WikiMediaAtlas: url = "http://" + subservers[subserverSeq % 3] + ".tiles.wmflabs.org/bw-mapnik/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.ThunderForestLandscape: url = "http://" + subservers[subserverSeq % 3] + ".tile.thunderforest.com/landscape/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.OpenTopoMap: url = "http://" + subservers[subserverSeq % 3] + ".tile.opentopomap.org/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.MapBoxSatellite: url = "http://" + subservers[subserverSeq % 3] + ".tiles.mapbox.com/v3/tmcw.map-j5fsp01s/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; case TILE_SERVER.Sputnik: url = "http://" + subservers[subserverSeq % 3] + ".tiles.maps.sputnik.ru/tiles/kmt2/" + ti.zoomLevel + "/" + ti.x + "/" + ti.y + ".png"; break; default: Debug.LogError("Tile server not defined: " + tileServer.ToString()); url = ""; break; } }