private void BuildGrid() { var gridLines = new List <Feature>(); if (CoordinateSystemFactory == null) { log.DebugFormat("Showing map grid is only supported when map has coordinate system defined"); return; // can only draw if coordinate system factory is available } for (var i = -180; i <= 180; i += 10) { var coordinates = new Coordinate[179]; for (var j = -89; j <= 89; j++) { coordinates[j + 89] = new Coordinate(i, j); } gridLines.Add(new Feature { Geometry = new LineString(coordinates) }); } for (var i = -90; i <= 90; i += 10) { var coordinates = new Coordinate[361]; for (var j = -180; j <= 180; j++) { coordinates[j + 180] = new Coordinate(j, i); } gridLines.Add(new Feature { Geometry = new LineString(coordinates) }); } var src = CoordinateSystemFactory.CreateFromSRID(4326 /* WGS84 */); var dst = CoordinateSystem; var transformation = dst == null ? null : CoordinateTransformationFactory.CreateFromCoordinateSystems(src, dst); gridLayer = new VectorLayer { DataSource = new FeatureCollection { Features = gridLines, CoordinateSystem = src }, CoordinateTransformation = transformation, ShowInTreeView = false, ShowInLegend = false, Selectable = false, Map = this }; gridLayer.Style.Line.Color = Color.FromArgb(50, 100, 100, 100); }