Skip to content

Instantly share code, notes, and snippets.

@andreas-nesheim
Created September 23, 2022 18:55
Show Gist options
  • Save andreas-nesheim/db5ffec54196e3ea81ce34fa2c7a0ece to your computer and use it in GitHub Desktop.
Save andreas-nesheim/db5ffec54196e3ea81ce34fa2c7a0ece to your computer and use it in GitHub Desktop.
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