Hi Andreas,
As below is a sample which shows how to show the mouse coordinates under 4326 event the map is rendered under 31466.
If you need the mouse coordinate shows under 31466, please just remove the event CustomFormatted and don’t set the MouseCoordinateType.
private void WpfMap_Loaded(object sender, RoutedEventArgs e)
{
wpfMap1.MapUnit = GeographyUnit.Meter;
WmtsLayer wmtsLayer = new WmtsLayer(new Collection<Uri> { new Uri("Your server uri") });
wmtsLayer.Parameters.Add("LAYER", "yourlayer");
wmtsLayer.Parameters.Add("STYLE", "default");
wmtsLayer.Parameters.Add("FORMAT", "image/png");
wmtsLayer.TileMatrixSetName = "EPSG:31466";
var overlay = new LayerOverlay();
overlay.Layers.Add(wmtsLayer);
wpfMap1.Overlays.Add(overlay);
wpfMap1.CurrentExtent = new RectangleShape(Your layer bouding box);
wpfMap1.MapTools.MouseCoordinate.IsEnabled = true;
wpfMap1.MapTools.MouseCoordinate.MouseCoordinateType = MouseCoordinateType.Custom;
wpfMap1.MapTools.MouseCoordinate.CustomFormatted += MouseCoordinate_CustomFormatted;
wpfMap1.Refresh();
}
private void MouseCoordinate_CustomFormatted(object sender, CustomFormattedMouseCoordinateMapToolEventArgs e)
{
var proj4 = new Proj4Projection
{
InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326),
ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(31466)
};
proj4.Open();
var positionCurrentCoordinates = proj4.ConvertToInternalProjection(new PointShape(e.WorldCoordinate.X, e.WorldCoordinate.Y));
var x = positionCurrentCoordinates.GetCenterPoint().X;
var y = positionCurrentCoordinates.GetCenterPoint().Y;
e.Result = string.Format("{0},{1}", x.ToString("N6"), y.ToString("N6"));
}
Wish that’s helpful.
Regards,
Don