![]() Var canvasBitmap = CanvasBitmap.CreateFromSoftwareBitmap(resourceCreator, softwareBitmap) ![]() Var resourceCreator = CanvasDevice.GetSharedDevice() Var softwareBitmap = new SoftwareBitmap(BitmapPixelFormat.Bgra8, pixelHeight, pixelWidth, BitmapAlphaMode.Premultiplied) ![]() Var outputStream = randomAccessStream.GetOutputStreamAt(0) Var randomAccessStream = new InMemoryRandomAccessStream() private async Task CreateBitmapAsStreamAsync(List lines, int zoom) Var filterdLines = GetLinesByGeoRect(rect) Ī = await CreateBitmapAsStreamAsync(filterdLines, args.ZoomLevel) Īnd this event is particular fit to draw a concrete Tile that you can see in image up (I have used ds.DrawCircle to do test drawing). TileSystem.PixelXYToLatLong(pixelX, pixelY, args.ZoomLevel, out double latTopLeft, out double lngTopLeft) TileSystem.TileXYToPixelXY(args.X, args.Y, out int pixelX, out int pixelY) private async void customDataSource_BitmapRequestedAsync(CustomMapTileDataSource sender, MapTileBitmapRequestedEventArgs args) Now I need to draw lines on each Tile which UWP MapControl provides.Īll my lines are precalculated with WGS82 coordinates and well tested.Īnd here I can get WGS83 rect to filter lines I have to draw. So far I can draw custom Tiles on fly with some shapes (see image below). ![]() So you have to apply tan (lat) and then multiply with the same scale factor as in x-direction.I am implementing CustomMapTileDataSource feature. But with increasing latitude, parallels must be spread wider and wider in order to maintain angular correctness. (b) Now the latitude: At the equator, the latitude is mapped to the y-axis by the same factor as you used for the longitude. Choose that factor in a suitable way such that the desired longitudinal range fits on your window. (a) Map your longitude to the x-coordinate by simple multiplication by a scale factor. To write the code for that projection is usually the easiest part and more or less straight forward. Then decide, which projection would be most suited for your application. Example are: Cylindrical, Conical, Conformal. And for mapping the surface of a sphere to a plane there are many alternatives, each of them having their specific advantages and disadvantages. What you are looking for is a so-called projection. I just read that the minutes and seconds are divided in 90 Units not in 60 as I was supposing. If you want to do it anyways, the only thing you have to do is to add the seconds to the formula. 360*2 = 720 and 720>640 so you are already not going to be able to accurately represent points in less than 35 or 40 Minutes scale. In 640x480 Resolution of display, you are not going to have any difference considering the seconds or not. The minus (-) in Y is because North coordinates are positive, but you need to decrease the pixels to go upwards because the Pixel (0,0) is in the upper-left corner. I consider the format of your 2nd comment (Positive to north and east). Since you mentioned that you want it in a sort of 3d cylinder then you can use the principle of solution 2 and apply part of my "thinking" to make the scales adapting it to your view-model. So that 179° and 89' = the border of the screen. If you consider the world as a 2d Map, the point of Latitude=0☀' and Longitude=0☀' is your X=0, Y=0, which is in the center of the display Pixel=(340,240) Your display is quite small (640,480) so the resolution is not going to be so accurated anyways. I am supposing that you don't need the Z-Axis Probably this is not going to be the best approach as well but. I had deleted the solution because I thought it was not "professional", but seeing your comments to other questions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |