public void TileGeometryTransform_Transform_WebMercatorRegression2() { var tileGeometry = new TileGeometryTransform(new Tile(0, 0, 1), 4096); var x = 0; var y = 0; tileGeometry.Transform(new CoordinateArraySequence(new Coordinate[] { new Coordinate(-90, 85.0 / 2), }), 0, ref x, ref y); Assert.Equal(2048, x); Assert.Equal(3025, y); }
/// <summary> /// Adds the given linestring. /// </summary> /// <param name="heatMapTile">The tile.</param> /// <param name="lineString">The linestring.</param> /// <param name="cost">The cost.</param> public static void Add(this HeatMapTile heatMapTile, LineString lineString, uint cost = 1) { void Draw(int x, int y) { if (x < 0) { return; } if (y < 0) { return; } if (x >= heatMapTile.Resolution) { return; } if (y >= heatMapTile.Resolution) { return; } heatMapTile[x, y] += cost; } var tile = new Tile(heatMapTile.TileId); var tgt = new TileGeometryTransform(tile, heatMapTile.Resolution); int currentX = 0, currentY = 0; for (var c = 0; c < lineString.Coordinates.Length; c++) { var previousX = currentX; var previousY = currentY; tgt.Transform(lineString.CoordinateSequence, c, ref currentX, ref currentY); if (c == 0) { continue; } Bresenhams(previousX, previousY, currentX, currentY, Draw); } }