Skip to content

Commit

Permalink
Fix nest and weather polygons for staticmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
versx committed Nov 30, 2020
1 parent 5aed394 commit 11efdd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Utilities/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Crypto.Tls;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

Expand Down Expand Up @@ -42,22 +41,23 @@ public static string GetStaticMapsUrl(string templateFileName, string staticMapU
StaticMapConfig staticMap = JsonConvert.DeserializeObject<StaticMapConfig>(staticMapData);

var url = string.Format(staticMapUrl, latitude, longitude, staticMapZoom);
var markerUrl = staticMap.Markers.Count > 0 ? url + "?markers=" + Uri.EscapeDataString(JsonConvert.SerializeObject(staticMap.Markers)) : string.Empty;
//var markerUrl = staticMap.Markers.Count > 0 ? url + "?markers=" + Uri.EscapeDataString(JsonConvert.SerializeObject(staticMap.Markers)) : string.Empty;
var markerUrl = staticMap.Markers.Count > 0 ? url + "?markers=" + JsonConvert.SerializeObject(staticMap.Markers) : string.Empty;

if (feature != null)
{
var latlng = OsmManager.MultiPolygonToLatLng(feature.Geometry?.Coordinates, true);
var polygonKey = "&polygons=";
var polygonUrl = @"[{""fill_color"":""rgba(100.0%,0.0%,0.0%,0.5)"",""stroke_color"":""black"",""stroke_width"":1,""path"":" + latlng + "}]";
var polygonUrl = @"[{""fill_color"":""rgba(100.0%,0.0%,0.0%,0.5)"",""stroke_color"":""black"",""stroke_width"":1,""path"":""" + latlng + @"""}]";
markerUrl += polygonKey + Uri.EscapeDataString(polygonUrl);
}

if (multiPolygon != null)
{
var latlng = OsmManager.MultiPolygonToLatLng(new List<MultiPolygon> { multiPolygon }, false);
var polygonKey = "&polygons=";
var polygonUrl = @"[{""fill_color"":""rgba(100.0%,0.0%,0.0%,0.5)"",""stroke_color"":""black"",""stroke_width"":1,""path"":" + latlng + "}]";
markerUrl += polygonKey + Uri.EscapeDataString(polygonUrl);
var polygonUrl = @"[{""fill_color"":""rgba(100.0%,0.0%,0.0%,0.5)"",""stroke_color"":""black"",""stroke_width"":1,""path"":""" + latlng + @"""}]";
markerUrl += polygonKey + polygonUrl;//Uri.EscapeDataString(polygonUrl);
}

return markerUrl;
Expand Down

0 comments on commit 11efdd4

Please sign in to comment.