I work with UWP MapControl
and adding some MapPolylines
.
And they looks ugly (see pic below)
I assume should be kind of antialiasing
property but cannot find it here.
Please help and thank you!
C#
var mapPolyline = new MapPolyline();
var geoPositions = new List<BasicGeoposition>();
foreach (var vertex in polyLine.Vertex)
{
// adding BasicGeopositions...
};
mapPolyline.StrokeColor = Colors.Black;
mapPolyline.StrokeThickness = 1;
mapPolyline.Path = new Geopath(geoPositions);
((MapElementsLayer)impotMapLayer).MapElements.Add(mapPolyline);
UPDATE #1 based on the answer
I have investigated this article "Overlay tiled images on a map" and also
this one "MapTileBitmapRequestedEventArgs Class"
and cannot get the clear definition of the X and Y of "MapTileBitmapRequestedEventArgs Class"
The article says
X Gets the X value of the requested tile.
Y Gets the Y value of the requested tile.
Using MSDN example from here I get following log for X, Y, Zoom
X 6073 Y 2617 Zoom 13
X 6072 Y 2616 Zoom 13
X 6071 Y 2615 Zoom 13
X 6071 Y 2617 Zoom 13
X 6072 Y 2614 Zoom 13
X 6073 Y 2615 Zoom 13
X 6071 Y 2616 Zoom 13
X 6073 Y 2614 Zoom 13
X 6072 Y 2615 Zoom 13
and etc
Would you mind clarify what those numbers are exactly and how I can associate it with geolocations set of vertices in memory if I want create tile-image only, please? (My polylines set already calculated in geopoints.)
Thank you very much!
UPDATE #2 Here is the solution
First of all I read this article https://learn.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system?redirectedfrom=MSDN
So we need TileSystem
to make series of convertions
namespace Microsoft.MapPoint
{
static class TileSystem
...
The X and Y of MapTileBitmapRequestedEventArgs
are Tile's XY we have to pass to TileSystem.TileXYToPixelXY(args.X, args.Y, out int pixelX, out int pixelY);
The final code is following based on https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/overlay-tiled-images
private async void customDataSource_BitmapRequestedAsync(CustomMapTileDataSource sender, MapTileBitmapRequestedEventArgs args)
{
var deferral = args.Request.GetDeferral();
TileSystem.TileXYToPixelXY(args.X, args.Y, out int pixelX, out int pixelY);
TileSystem.PixelXYToLatLong(pixelX, pixelY, args.ZoomLevel, out double lat, out double lng);
Debug.WriteLine($"lat {lat} lng {lng} Zoom {args.ZoomLevel}");
// next step is to extract from my custom array polylines accroding to TileSystem.PixelXYToLatLong
// and finally pass it inside of CreateBitmapAsStreamAsync(array to draw);
args.Request.PixelData = await CreateBitmapAsStreamAsync(array to draw);
deferral.Complete();
}
Currently MapPolylines are drawn without antialiasing and there is no setting to change that behavior. Looking at your screenshot, you may be better served by using a custom tile layer. See CustoMapTileDatasource here: https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/overlay-tiled-images You can draw each tile in a callback using whatever method you like including antialiasing. It will also tend to perform better for a large collection of static lines like the topographic contours in your example