private PureImage GetTileImage(GPoint pos, int zoom, Size tileSize) { var tileCenterLatLng = TileToWorldPos(pos.X + 0.5, pos.Y + 0.5, zoom); var map = new StaticMapRequest { Center = new Location(tileCenterLatLng.Lat + "," + tileCenterLatLng.Lng), MapType = _mapType, Size = tileSize, Zoom = zoom, Sensor = false }; var imageUri = map.ToUri().ToString(); if (GoogleSigned.SigningInstance != null) { imageUri = GoogleSigned.SigningInstance.GetSignedUri(imageUri); } PureImage image = null; try { image = GetTileImageUsingHttp(imageUri); } catch (WebException e) { // WebException such as 404 / Forbidden etc. Debug.WriteLine(e.Message); } return(image); }
// TO change label 1..n private string _LocationsMapUrlGenerator (ImageParameters imgParams, string markerColor = "green") { string locationLetter = char.ToUpper(imgParams.label[0]).ToString(); List <ILocationString> locationsList = new List <ILocationString>(); foreach (var longLat in imgParams.locationsLongLat) { locationsList.Add(new Location(longLat.Item1, longLat.Item2)); } Marker marker = new Marker(); marker.Locations = locationsList; marker.Style = new MarkerStyle(); marker.Style.Color = markerColor; marker.Style.Label = locationLetter; StaticMapRequest request = new StaticMapRequest (new Location(double.Parse(imgParams.centerLocation.Item1), double.Parse(imgParams.centerLocation.Item2)), imgParams.zoom, new ImageSize(512, 512)); request.Markers = new List <Marker> { marker }; request.Size = new ImageSize(512, 512); return(new StaticMapsEngine().GenerateStaticMapURL(request)); }
public void Markers_ShouldNotUseExtraZeros_BecauseUrlLengthIsLimited() { StaticMapRequest map = new StaticMapRequest { Sensor = false }; map.Markers.Add(new LatLng(40.0, -60.0)); map.Markers.Add(new LatLng(41.1, -61.1)); map.Markers.Add(new LatLng(42.22, -62.22)); map.Markers.Add(new LatLng(44.444, -64.444)); map.Markers.Add(new LatLng(45.5555, -65.5555)); map.Markers.Add(new LatLng(46.66666, -66.66666)); map.Markers.Add(new LatLng(47.777777, -67.777777)); map.Markers.Add(new LatLng(48.8888888, -68.8888888)); // based on this http://gis.stackexchange.com/a/8674/15274, // I'm not too concerned about more than 7 decimals of precision. string actual = map.ToUri().Query; StringAssert.Contains("markers=40,-60&", actual); StringAssert.Contains("markers=41.1,-61.1&", actual); StringAssert.Contains("markers=42.22,-62.22&", actual); StringAssert.Contains("markers=44.444,-64.444&", actual); StringAssert.Contains("markers=45.5555,-65.5555&", actual); StringAssert.Contains("markers=46.66666,-66.66666&", actual); StringAssert.Contains("markers=47.777777,-67.777777&", actual); StringAssert.Contains("markers=48.8888888,-68.8888888&", actual); }
private void UpdateMap(LatLng[] locations) { if (locations == null) { return; } CenterGeoCoordinate = new LatLng(locations.Select(l => l.Latitude).Average(), locations.Select(l => l.Longitude).Average()); var map = new StaticMapRequest { Language = "he-IL", Center = CenterGeoCoordinate, Size = new MapSize(400, 400), Path = new Path() }; foreach (var point in locations) { map.Path.Points.Add(point); map.Markers.Add(point); } MapUri = map.ToUriSigned().ToString(); }
private static HeroCard GetCard(string orderId) { var map = new StaticMapRequest { Path = new Path { Color = MapColor.FromName("red"), Points = new List <Location> { new Location("Port of Hai Phong, Hai Phong"), new Location("Cam Ranh bay, Khanh Hoa, 650000"), new Location("Saigon Port, Ho Chi Minh city") } }, Center = new Location("Cam Ranh bay, Khanh Hoa, 650000"), Size = new MapSize(500, 500), Zoom = 4 }; return(new HeroCard { Title = $"Order number {orderId}", Subtitle = $"Expected arrive date: {DateTime.Now.AddDays(7).ToShortDateString()}", Text = "Shipment is currently in Cam Ranh bay, Khanh Hoa. The status is Delivered.", Images = new List <CardImage> { new CardImage(map.ToUri().ToString()) } }); }
public void TestMap(IEnumerable <Location> locations) { Console.WriteLine($"{nameof(TestMap)}:"); var markers = new List <Marker>() { new Marker() { Locations = locations.Cast <ILocationString>().ToList(), Style = new MarkerStyle() { Color = "red", } } }; var request = new StaticMapRequest(markers, new ImageSize(512, 512)) { ApiKey = ApiKey, }; var engine = new StaticMapsEngine() { }; Console.Write("\tGenerating Map URL ..."); try { var url = engine.GenerateStaticMapURL(request); Console.Write(url); } catch (Exception ex) { Console.Write($"\t{ex.GetType()} {ex.Message}"); } Console.WriteLine(); }
private string createImage(StaticMapRequest s, string rootPath) { Bitmap image; string url = s.toUrlRequest(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.GZip; string path = rootPath + @"StaticMaps\" + s.Id + "_map.png"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); image = new Bitmap(stream); try { image.Save(path); } catch (Exception e) { return("ERROR"); } // image.Save(path); response.Dispose(); stream.Dispose(); return(s.Id + "_map.png"); }
private async Task <Bitmap> downloadMapBitmapAsync(string styleParams) { StaticMapRequest map = new StaticMapRequest(); map.Center = new LatLng(latLng[0], latLng[1]); map.Size = new Size(mapDimensions[0], mapDimensions[1]); map.Zoom = zoom; map.Sensor = false; // Get uri from map. // Add style parameters to map. var uri = map.ToUri().ToString() + styleParams; // Open up web client. using (WebClient webClient = new WebClient()) { // Download byte stream from uri asynchronously. // (If done synchronously, there will be a huge delay for each one!) byte[] byteData = await webClient.DownloadDataTaskAsync(uri); // Convert byte stream to a bitmap image. using (MemoryStream mem = new MemoryStream(byteData)) { using (Image img = Image.FromStream(mem)) { return(new Bitmap(img)); } } } }
private void refreshMap() { if (resultsTreeView.SelectedItem == null) { return; } var location = ((LatLng)((TreeViewItem)resultsTreeView.SelectedItem).Tag); var map = new StaticMapRequest(); map.Center = location; map.Zoom = Convert.ToInt32(zoomSlider.Value); map.Size = new System.Drawing.Size(332, 332); map.Markers.Add(map.Center); map.MapType = (MapTypes)Enum.Parse(typeof(MapTypes), ((ComboBoxItem)mapTypeComboBox.SelectedItem).Content.ToString(), true); map.Sensor = false; var image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnDemand; image.UriSource = map.ToUri(); image.DownloadFailed += new EventHandler <ExceptionEventArgs>(image_DownloadFailed); image.EndInit(); image1.Source = image; }
private void refreshMap(Location location, Image imageControl) { var request = new StaticMapRequest { Center = location, Zoom = Convert.ToInt32(zoomSlider.Value), Size = new MapSize(Convert.ToInt32(imageControl.Width), Convert.ToInt32(imageControl.Height)), MapType = (MapTypes)Enum.Parse(typeof(MapTypes), ((ComboBoxItem)mapTypeComboBox.SelectedItem).Content.ToString(), true) }; request.Markers.Add(request.Center); var mapSvc = new StaticMapService(); var imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.StreamSource = mapSvc.GetStream(request); imageSource.CacheOption = BitmapCacheOption.OnLoad; imageSource.EndInit(); imageControl.Source = imageSource; }
private void refreshMap() { if (resultsTreeView.SelectedItem == null) { return; } var location = ((LatLng)((TreeViewItem)resultsTreeView.SelectedItem).Tag); var map = new StaticMapRequest { Center = location, Zoom = Convert.ToInt32(zoomSlider.Value), Size = new MapSize(332, 332), MapType = (MapTypes)Enum.Parse(typeof(MapTypes), ((ComboBoxItem)mapTypeComboBox.SelectedItem).Content.ToString(), true) }; map.Markers.Add(map.Center); var mapSvc = new StaticMapService(); using (var ms = new System.IO.MemoryStream(mapSvc.GetImage(map))) { var image = new BitmapImage(); image.BeginInit(); image.StreamSource = mapSvc.GetStream(map); image.CacheOption = BitmapCacheOption.OnLoad; image.EndInit(); image1.Source = image; } }
public void Sensor_not_set_throws_invalidoperationexception_when_touri_called() { StaticMapRequest sm = new StaticMapRequest(); sm.ToUri(); Assert.Fail("InvalidOPerationException was expected"); }
public void Scale_argumentoutofrange() { StaticMapRequest sm = new StaticMapRequest() { Scale = 3 }; Assert.Fail("Expected an ArgumentOutOfRange exception."); }
public void Scale_validvalue_1() { StaticMapRequest sm = new StaticMapRequest() { Scale = 1 }; Assert.AreEqual(1, sm.Scale); }
public void BasicTest() { // downtown New York City StaticMapRequest request = new StaticMapRequest(new AddressLocation("Brooklyn Bridge,New York,NY"), 14, new ImageSize(512, 512)) { MapType = MapType.Roadmap, Markers = new List <Marker>() { new Marker() { Style = new MarkerStyle() { Color = "blue", Label = "S" }, Locations = new List <ILocation>() { new Location(40.702147, -74.015794) } }, new Marker() { Style = new MarkerStyle() { Color = "green", Label = "G" }, Locations = new List <ILocation>() { new Location(40.711614, -74.012318) } }, new Marker() { Style = new MarkerStyle() { Color = "red", Label = "C" }, Locations = new List <ILocation>() { new Location(40.718217, -73.998284) } } }, Sensor = false }; string generateStaticMapURL = staticMapGenerator.GenerateStaticMapURL(request); string expectedResult = @"http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&sensor=false"; Assert.AreEqual(expectedResult, generateStaticMapURL); }
public void Zoom_argumentoutofrange_bottom() { StaticMapRequest sm = new StaticMapRequest() { Sensor = false, Zoom = -1 }; Assert.Fail("Zoom was set to invalid value."); }
public void Invalid_size_max() { StaticMapRequest sm = new StaticMapRequest() { Sensor = false, Size = new System.Drawing.Size(4097, 4097) }; Assert.Fail("Invalid size was set to property but no exception happened."); }
public void ImageSize() { var request = new StaticMapRequest(new Location(0, 0), 1, new ImageSize(400, 50)); string expectedResult = "http://maps.google.com/maps/api/staticmap" + "?center=0%2C0&zoom=1&size=400x50&sensor=false"; string generateStaticMapURL = new StaticMapsEngine().GenerateStaticMapURL(request); Assert.AreEqual(expectedResult, generateStaticMapURL); }
public void AddressTest() { var request = new StaticMapRequest(new AddressLocation("Berkeley,CA"), 14, new ImageSize(400, 400)); string expectedResult = "http://maps.google.com/maps/api/staticmap" + "?center=Berkeley%2CCA&zoom=14&size=400x400&sensor=false"; string generateStaticMapURL = new StaticMapsEngine().GenerateStaticMapURL(request); Assert.AreEqual(expectedResult, generateStaticMapURL); }
public void ZoomLevels() { var request = new StaticMapRequest(new Location(40.714728, -73.998672), 12, new ImageSize(400, 400)); string expectedResult = "http://maps.google.com/maps/api/staticmap" + "?center=40.714728%2C-73.998672&zoom=12&size=400x400&sensor=false"; string generateStaticMapURL = new StaticMapsEngine().GenerateStaticMapURL(request); Assert.AreEqual(expectedResult, generateStaticMapURL); }
public void Implicit_Address_set_from_string() { var map = new StaticMapRequest(); map.Center = "New York, NY"; string expected = "New York, NY"; string actual = map.Center.ToString(); Assert.AreEqual(expected, actual); }
public void Zoom_setbacktonull() { StaticMapRequest sm = new StaticMapRequest() { Zoom = 1 }; sm.Zoom = null; Assert.Pass(); }
public void StaticMapRequest_Example() { var map = new StaticMapRequest(); map.Center = new Location("1600 Amphitheatre Parkway Mountain View, CA 94043"); map.Size = new MapSize(400, 400); map.Zoom = 14; var imgTagSrc = map.ToUri(); Assert.Pass(); }
public void MapTypes() { var request = new StaticMapRequest(new Location(40.714728, -73.998672), 12, new ImageSize(400, 400)); request.MapType = MapType.Terrain; string expectedResult = @"http://maps.google.com/maps/api/staticmap" + @"?center=40.714728%2C-73.998672&zoom=12&size=400x400&maptype=terrain&sensor=false"; string actualResult = new StaticMapsEngine().GenerateStaticMapURL(request); Assert.AreEqual(expectedResult, actualResult); }
private string constructUriParameters(StaticMapRequest staticMapRequest) { var parameters = API_SPECIFIER; parameters += _uriParameterBuilder.BuildImageSize(staticMapRequest.ImageSize); parameters += "&" + _uriParameterBuilder.BuildScale(staticMapRequest.Scale); parameters += "&" + _uriParameterBuilder.BuildFormat(staticMapRequest.ImageFormat); parameters += "&" + _uriParameterBuilder.BuildMapPath(staticMapRequest.MapPath); parameters += "&" + _uriParameterBuilder.BuildApiKey(_apiOptions.ApiKey); return(staticMapRequest.MapMarkers.Aggregate(parameters, (current, mapMarker) => current + "&" + _uriParameterBuilder.BuildMapMarker(mapMarker))); }
public void StaticMapRequest_Example() { var map = new StaticMapRequest(); map.Center = new Location("1600 Amphitheatre Parkway Mountain View, CA 94043"); map.Size = new MapSize(400, 400); map.Zoom = 14; var imgTagSrc = map.ToUri(); //check program functional outputs, not google's returned values Assert.That(imgTagSrc.Query.Contains("zoom=14")); }
public void Path_NonstandardColor_EncodedProperly() { var map = new StaticMapRequest { Sensor = false }; map.Paths.Add(new Path(new LatLng(30.0, -60.0)) { Color = System.Drawing.Color.FromArgb(0x80, 0xA0, 0xC0) }); string color = ExtractColorFromUri(map.ToUri()); Assert.AreEqual("0X80A0C0FF", color.ToUpper()); }
public void BasicTest() { // downtown New York City StaticMapRequest request = new StaticMapRequest( new AddressLocation("Brooklyn Bridge,New York,NY"), 14, new ImageSize(512, 512)) { MapType = MapType.Roadmap, Markers = new List <Marker> { new Marker { Style = new MarkerStyle { Color = "blue", Label = "S" }, Locations = new List <ILocationString> { new Location(40.702147, -74.015794) } }, new Marker { Style = new MarkerStyle { Color = "green", Label = "G" }, Locations = new List <ILocationString> { new Location(40.711614, -74.012318) } }, new Marker { Style = new MarkerStyle { Color = "red", Label = "C" }, Locations = new List <ILocationString> { new Location(40.718217, -73.998284) } } }, Sensor = false }; string expectedResult = "http://maps.google.com/maps/api/staticmap" + "?center=Brooklyn%20Bridge%2CNew%20York%2CNY&zoom=14&size=512x512&maptype=roadmap" + "&markers=color%3Ablue%7Clabel%3AS%7C40.702147%2C-74.015794&markers=color%3Agreen%7Clabel%3AG%7C40.711614%2C-74.012318" + "&markers=color%3Ared%7Clabel%3AC%7C40.718217%2C-73.998284&sensor=false"; string generateStaticMapURL = new StaticMapsEngine().GenerateStaticMapURL(request); Assert.AreEqual(expectedResult, generateStaticMapURL); }
public BitmapImage GenerateMap(string address) { GoogleSigned.AssignAllServices(new GoogleSigned(API_KEY)); var map = new StaticMapRequest(); map.Center = new Location(address); map.Size = new System.Drawing.Size(400, 400); map.Zoom = 14; StaticMapService staticMapService = new StaticMapService(); BitmapImage img = new BitmapImage(); img.StreamSource = staticMapService.GetStream(map); return(img); }
public void BasicUri() { string expected = "/maps/api/staticmap?center=30.1,-60.2&size=512x512&sensor=false"; StaticMapRequest sm = new StaticMapRequest() { Sensor = false, Center = new LatLng(30.1, -60.2) }; Uri actualUri = sm.ToUri(); string actual = actualUri.PathAndQuery; Assert.AreEqual(expected, actual); }
/// <summary>Generates the static map URL.</summary> /// <param name="request">The request.</param> /// <returns>The <see cref="string"/></returns> /// <exception cref="System.ArgumentException"> /// Size is invalid /// or /// Marker style color can't be empty /// or /// Path style color can't be empty /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// Request image format is unknown. /// </exception> public string GenerateStaticMapUrl(StaticMapRequest request) { var scheme = request.IsSSL ? "https://" : "http://"; var parametersList = new QueryStringParametersList(); if (request.Center != null) { var center = request.Center; var centerLocation = center.LocationString; parametersList.Add("center", centerLocation); } if (request.Zoom != default(byte)) { parametersList.Add("zoom", request.Zoom.ToString()); } if (request.Size.Width != default(int) || request.Size.Height != default(int)) { var imageSize = request.Size; parametersList.Add("size", $"{imageSize.Width}x{imageSize.Height}"); } else { throw new ArgumentException("Size is invalid"); } if (request.ImageFormat != default(ImageFormat)) { string format; switch (request.ImageFormat) { case ImageFormat.Png8: format = "png8"; break; case ImageFormat.Png32: format = "png32"; break; case ImageFormat.Gif: format = "gif"; break; case ImageFormat.Jpg: format = "jpg"; break; case ImageFormat.JpgBaseline: format = "jpg-baseline"; break; default: throw new ArgumentOutOfRangeException(nameof(request.ImageFormat)); } parametersList.Add("format", format); } if (request.MapType != null) { string type; switch (request.MapType) { case MapType.Roadmap: type = "roadmap"; break; case MapType.Satellite: type = "satellite"; break; case MapType.Terrain: type = "terrain"; break; case MapType.Hybrid: type = "hybrid"; break; default: throw new ArgumentOutOfRangeException(nameof(request.MapType)); } parametersList.Add("maptype", type); } if (request.Style != null) { foreach (var style in request.Style) { var styleComponents = new List<string>(); if (style.MapFeature != default(MapFeature)) { string mapFeature; switch (style.MapFeature) { case MapFeature.All: mapFeature = "all"; break; case MapFeature.Administrative: mapFeature = "administrative"; break; case MapFeature.AdministrativeCountry: mapFeature = "administrative.country"; break; case MapFeature.AdministrativeLandParcel: mapFeature = "administrative.land_parcel"; break; case MapFeature.AdministrativeLocality: mapFeature = "administrative.locality"; break; case MapFeature.AdministrativeNeighborhood: mapFeature = "administrative.neighborhood"; break; case MapFeature.AdministrativeProvince: mapFeature = "administrative.province"; break; case MapFeature.Landscape: mapFeature = "landscape"; break; case MapFeature.LandscapeManMade: mapFeature = "landscape.man_made"; break; case MapFeature.LandscapeNatural: mapFeature = "landscape.natural"; break; case MapFeature.LandscapeNaturalLandcover: mapFeature = "landscape.natural.landcover"; break; case MapFeature.LandscapeNaturalTerrain: mapFeature = "landscape.natural.terrain"; break; case MapFeature.Poi: mapFeature = "poi"; break; case MapFeature.PoiAttraction: mapFeature = "poi.attraction"; break; case MapFeature.PoiBusiness: mapFeature = "poi.business"; break; case MapFeature.PoiGovernment: mapFeature = "poi.government"; break; case MapFeature.PoiMedical: mapFeature = "poi.medical"; break; case MapFeature.PoiPark: mapFeature = "poi.park"; break; case MapFeature.PoiPlaceOfWorship: mapFeature = "poi.place_of_worship"; break; case MapFeature.PoiSchool: mapFeature = "poi.school"; break; case MapFeature.PoiSportsComplex: mapFeature = "poi.sports_complex"; break; case MapFeature.Road: mapFeature = "road"; break; case MapFeature.RoadArterial: mapFeature = "road.arterial"; break; case MapFeature.RoadHighway: mapFeature = "road.highway"; break; case MapFeature.RoadHighwayControlledAccess: mapFeature = "road.highway.controlled_access"; break; case MapFeature.RoadLocal: mapFeature = "road.local"; break; case MapFeature.Transit: mapFeature = "transit"; break; case MapFeature.TransitLine: mapFeature = "transit.line"; break; case MapFeature.TransitStation: mapFeature = "transit.station"; break; case MapFeature.TransitStationAirport: mapFeature = "transit.station.airport"; break; case MapFeature.TransitStationBus: mapFeature = "transit.station.bus"; break; case MapFeature.TransitStationRail: mapFeature = "transit.station.rail"; break; case MapFeature.Water: mapFeature = "water"; break; default: throw new ArgumentOutOfRangeException(nameof(style.MapFeature)); } styleComponents.Add("feature:" + mapFeature); } if (style.MapElement != default(MapElement)) { string element; switch (style.MapElement) { case MapElement.All: element = "all"; break; case MapElement.Geometry: element = "geometry"; break; case MapElement.GeometryFill: element = "geometry.fill"; break; case MapElement.GeometryStroke: element = "geometry.stroke"; break; case MapElement.Labels: element = "lables"; break; case MapElement.LabelsIcon: element = "labels.icon"; break; case MapElement.LabelsText: element = "labels.text"; break; case MapElement.LabelsTextFill: element = "labels.text.fill"; break; case MapElement.LabelsTextStroke: element = "labels.text.stroke"; break; default: throw new ArgumentOutOfRangeException(nameof(style.MapElement)); } styleComponents.Add("element:" + element); } if (style.HUE != default(Color)) { styleComponents.Add("hue:0x" + ColorToHexConverter(style.HUE)); } var lightness = style.Lightness; if (lightness != null) { if (lightness < -100 || lightness > 100) { throw new ArgumentOutOfRangeException(nameof(style.Lightness)); } styleComponents.Add("lightness:" + lightness); } var saturation = style.Saturation; if (saturation != null) { if (saturation < -100 || saturation > 100) { throw new ArgumentOutOfRangeException(nameof(style.Saturation)); } styleComponents.Add("saturation:" + saturation); } var gamma = style.Gamma; if (gamma != null && gamma != 1.0) { if (gamma < 0.01 || gamma > 10.0) { throw new ArgumentOutOfRangeException(nameof(style.Gamma)); } styleComponents.Add("gamma:" + gamma); } var inverseLightness = style.InvertLightness; if (inverseLightness) { styleComponents.Add("inverse_lightnes:true"); } if (style.Weight != default(int)) { if (style.Weight < 0) { throw new ArgumentOutOfRangeException(nameof(style.Weight)); } styleComponents.Add("weight:" + style.Weight); } if (style.Color != default(Color)) { styleComponents.Add("color:0x" + ColorToHexConverter(style.Color)); } var mapVisibility = style.Visibility; if (mapVisibility != default(MapVisibility)) { string visibility; switch (mapVisibility) { case MapVisibility.On: visibility = "on"; break; case MapVisibility.Off: visibility = "off"; break; case MapVisibility.Simplified: visibility = "simplified"; break; default: throw new ArgumentOutOfRangeException(nameof(style.Visibility)); } styleComponents.Add("visibility:" + visibility); } parametersList.Add("style", string.Join("|", styleComponents)); } } var markers = request.Markers; if (markers != null) { foreach (var marker in markers) { var markerStyleParams = new List<string>(); var markerStyle = marker.Style; if (markerStyle != null) { if (string.IsNullOrWhiteSpace(markerStyle.Color)) { throw new ArgumentException("Marker style color can't be empty"); } markerStyleParams.Add("color:" + markerStyle.Color); if (!string.IsNullOrWhiteSpace(markerStyle.Label)) { markerStyleParams.Add("label:" + markerStyle.Label); } if (markerStyle.Size != default(MarkerSize)) { switch (markerStyle.Size) { case MarkerSize.Mid: markerStyleParams.Add("size:mid"); break; case MarkerSize.Tiny: markerStyleParams.Add("size:tiny"); break; case MarkerSize.Small: markerStyleParams.Add("size:small"); break; default: throw new ArgumentOutOfRangeException(); } } } var styleString = string.Join("|", markerStyleParams); var locations = string.Join("|", marker.Locations.Select(location => location.LocationString)); parametersList.Add("markers", $"{styleString}|{locations}"); } } var pathes = request.Pathes; if (pathes != null) { foreach (var path in pathes) { var pathStyleParams = new List<string>(); var pathStyle = path.Style; if (pathStyle != null) { if (string.IsNullOrWhiteSpace(pathStyle.Color)) { throw new ArgumentException("Path style color can't be empty"); } pathStyleParams.Add("color:" + pathStyle.Color); if (!string.IsNullOrWhiteSpace(pathStyle.FillColor)) { pathStyleParams.Add("fillcolor:" + pathStyle.FillColor); } if (pathStyle.Weight != default(int)) { pathStyleParams.Add("weight:" + pathStyle.Weight); } } var styleString = string.Join("|", pathStyleParams); var locations = string.Join("|", path.Locations.Select(location => location.LocationString)); parametersList.Add("path", $"{styleString}|{locations}"); } } parametersList.Add("sensor", request.Sensor ? "true" : "false"); return scheme + BaseUrl + "?" + parametersList.GetQueryStringPostfix(); }