private void WpfMap_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWpfOverlay worldov = new WorldMapKitWmsWpfOverlay(); Map1.Overlays.Add(worldov); worldov.WrappingMode = WrappingMode.WrapDateline; InMemoryFeatureLayer inmlayer = new InMemoryFeatureLayer(); Feature feature = new Feature("LINESTRING(171.528 60.713,171.649 60.69,171.785 60.722,171.836 60.755,171.988 60.783,172.114 60.799,172.256 60.853,172.462 60.947,172.552 61.007,172.708 61.066,172.827 61.118,172.956 61.15,173.193 61.196,173.352 61.212,173.593 61.248,173.82 61.26,174.031 61.271,174.284 61.305,174.485 61.322,174.753 61.334,175.066 61.347,175.296 61.344,175.43 61.306,175.577 61.277,175.693 61.254,175.814 61.229,175.784 61.287,175.701 61.331,175.733 61.42,175.882 61.449,176.017 61.508,176.125 61.504,176.206 61.472,176.352 61.413,176.528 61.396,176.736 61.407,176.928 61.425,177.038 61.442,177.251 61.357,177.401 61.326,177.528 61.326,177.597 61.359,177.61 61.44,177.674 61.473,177.887 61.482,177.986 61.457,178.171 61.445,178.475 61.479,178.545 61.519,178.789 61.546,179.029 61.568,179.238 61.598,179.504 61.634,179.632 61.664,179.848 61.662,179.992 61.662,-179.859 61.662,-179.771 61.691,-179.704 61.769,-179.667 61.823,-179.511 61.874,-179.401 61.908,-179.261 61.924,-179.089 61.94,-179.048 61.912,-179.097 61.859,-179.222 61.813,-179.317 61.76,-179.442 61.7,-179.581 61.647,-179.685 61.598,-179.829 61.564,179.967 61.466,179.921 61.401,179.911 61.308,179.967 61.217,-179.887 61.132,-179.857 61.076,-179.852 61.013,-179.943 60.949,179.977 60.918,179.882 60.876,179.872 60.823,179.962 60.757,-179.928 60.699,-179.804 60.684,-179.552 60.61,-179.17 60.657,-179.041 60.665,-178.896 60.676,-178.82 60.732,-178.806 60.809,-178.683 60.888,-178.624 60.963,-178.581 61.036,-178.523 61.089,-178.515 61.138,-178.445 61.205,-178.441 61.273,-178.304 61.371,-178.196 61.463,-178.049 61.524,-177.837 61.547,-177.637 61.602,-177.413 61.646,-177.165 61.648,-176.964 61.609,-176.873 61.553,-176.811 61.507,-176.622 61.424,-176.559 61.319,-176.479 61.268,-176.378 61.221,-176.421 61.122,-176.469 61.065,-176.444 61.01,-176.426 60.971,-176.225 60.857,-176.126 60.781,-176.016 60.672,-175.896 60.612,-175.876 60.601,-175.845 60.54,-175.728 60.489,-175.622 60.416,-175.49 60.373,-175.272 60.284,-175.079 60.107,-175.003 59.923,-175.014 59.732,-174.933 59.587,-174.894 59.421,-174.756 59.315,-174.535 59.217,-174.396 59.088,-174.303 58.995,-174.162 58.919,-173.708 58.794,-173.488 58.759,-173.131 58.714,-172.943 58.702,-172.651 58.66,-172.398 58.62,-172.277 58.519,-172.163 58.339,-172.177 58.176,-172.119 58.011,-171.964 57.862,-171.835 57.837,-171.642 57.887,-171.6 58.014,-171.576 58.1,-171.528 58.192,-171.435 58.265,-171.338 58.272,-171.223 58.171,-171.088 58.06,-170.941 57.975,-170.674 57.906,-170.322 57.883,-170.283 57.868,-170.134 57.838,-170.041 57.857,-169.895 57.885,-169.819 57.897,-169.648 57.911,-169.503 57.912,-169.447 57.907,-169.238 57.886,-169.015 57.982,-168.877 58.022,-168.713 58.013,-168.575 57.936,-168.448 57.853,-168.261 57.775,-168.019 57.693,-167.764 57.734,-167.635 57.838,-167.594 57.954,-167.5 58.094,-167.324 58.147,-167.134 58.264,-167.076 58.397,-167.023 58.484,-166.812 58.59,-166.654 58.692,-166.443 58.79,-166.289 58.876,-166.23 58.971,-166.294 59.092,-166.365 59.183,-166.336 59.324,-166.385 59.448,-166.417 59.558,-166.338 59.627,-166.187 59.667,-166.024 59.713,-165.749 59.812,-165.643 59.806,-165.564 59.776,-165.462 59.641,-165.487 59.577,-165.417 59.47,-165.336 59.388,-165.322 59.296,-165.528 59.237,-165.641 59.165,-165.482 59.069,-165.309 59.066,-165.219 59.002,-165.196 58.929,-165.173 58.855,-165.106 58.763,-165.123 58.671,-165.181 58.601,-165.145 58.525,-165.097 58.471,-165.087 58.344,-165.067 58.251,-165.074 58.135,-165.151 58.04,-165.268 57.998,-165.38 57.919,-165.41 57.857,-165.282 57.746,-165.152 57.786,-164.961 57.904,-164.811 58.07,-164.851 58.193,-164.769 58.296,-164.596 58.369,-164.407 58.471,-164.372 58.679,-164.352 58.869,-164.444 59.139,-164.575 59.28,-164.745 59.438,-164.846 59.57,-164.974 59.694,-165 59.792,-165.112 59.981,-165.212 60.121,-165.236 60.195,-165.119 60.207,-164.943 60.105,-164.694 59.952,-164.503 59.855,-164.364 59.752,-164.119 59.614,-163.776 59.516,-163.406 59.481,-163.181 59.518,-162.935 59.588,-162.741 59.673,-162.613 59.741,-162.453 59.843,-162.283 59.836,-162.123 59.762,-162.048 59.706,-161.988 59.664,-161.876 59.643) "); inmlayer.InternalFeatures.Add(feature); inmlayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new MyLineStyle(new GeoPen(GeoColor.SimpleColors.Black)); inmlayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay ov = new LayerOverlay(); ov.TileType = TileType.SingleTile; inmlayer.WrappingMode = WrappingMode.WrapDateline; inmlayer.WrappingExtent = new RectangleShape(-180, 90, 180, -90); ov.Layers.Add(inmlayer); Map1.Overlays.Add(ov); Map1.CurrentExtent = new RectangleShape(-180, 90, 180, -90); Map1.Refresh(); } class MyLineStyle : LineStyle { public MyLineStyle(GeoPen outerPe) : base(outerPe) { } protected override void DrawCore(System.Collections.Generic.IEnumerable features, GeoCanvas canvas, Collection labelsInThisLayer, Collection labelsInAllLayers) { foreach (Feature feature in features) { LineShape line = feature.GetShape() as LineShape; for (int i = 1; i < line.Vertices.Count; i++) { if (line.Vertices[i].X - line.Vertices[i - 1].X > 180) { line.Vertices[i] = new Vertex(line.Vertices[i].X - 360, line.Vertices[i].Y); } else if (line.Vertices[i - 1].X - line.Vertices[i].X > 180) { line.Vertices[i] = new Vertex(line.Vertices[i].X + 360, line.Vertices[i].Y); } } if (!canvas.CurrentWorldExtent.Intersects(line)) { line.TranslateByOffset(-360, 0); } feature.WellKnownBinary = line.GetWellKnownBinary(); } base.DrawCore(features, canvas, labelsInThisLayer, labelsInAllLayers); } }