Created
September 23, 2022 18:55
-
-
Save andreas-nesheim/db5ffec54196e3ea81ce34fa2c7a0ece to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using var httpClient = new HttpClient(); | |
stringResult = await httpClient.GetStringAsync(url); | |
jsonResult = JsonConvert.DeserializeObject<FeatureCollection>(stringResult); | |
foreach (var parkingZone in jsonResult.Features) | |
{ | |
if (parkingZone.Geometry is not Polygon polygon) continue; | |
var points = polygon.Coordinates.First().Coordinates; | |
var mapPolygon = new Microsoft.Maui.Controls.Maps.Polygon | |
{ | |
StrokeWidth = 8, | |
StrokeColor = Color.Parse("#1BA1E2"), | |
FillColor = Color.Parse("#881BA1E2"), | |
//ClassId = parkingZone.Properties.ElementAt(4).Value.ToString() | |
}; | |
foreach (var p in points) | |
{ | |
mapPolygon.Geopath.Add(new Location(p.Latitude, p.Longitude)); | |
} | |
map.MapElements.Add(mapPolygon); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment