C# 如何使用sharpmap在地球上渲染一个国家的图像
我在SQL数据库中有一个区域边界列表,我正在使用sharpmap为我需要的每个国家渲染缩略图。它工作得非常好 但我想更进一步,在它周围加上一个小地球仪,把这个国家定位在它在全球的位置上,但我不知道从哪里开始 以下是我目前正在使用的代码,用于渲染国家大拇指。有什么想法吗C# 如何使用sharpmap在地球上渲染一个国家的图像,c#,.net,geolocation,sharpmap,C#,.net,Geolocation,Sharpmap,我在SQL数据库中有一个区域边界列表,我正在使用sharpmap为我需要的每个国家渲染缩略图。它工作得非常好 但我想更进一步,在它周围加上一个小地球仪,把这个国家定位在它在全球的位置上,但我不知道从哪里开始 以下是我目前正在使用的代码,用于渲染国家大拇指。有什么想法吗 var map = new Map(new Size(command.Width, command.Height)); map.BackColor = Color.Transparent; var countryGeometry
var map = new Map(new Size(command.Width, command.Height));
map.BackColor = Color.Transparent;
var countryGeometry = GeometryFromWKT.Parse(command.CountryLevelWkt);
IProvider countryProvider = new GeometryFeatureProvider(countryGeometry);
var countryLayer = new VectorLayer("country", countryProvider);
var borderColor = System.Drawing.ColorTranslator.FromHtml(command.BorderColor);
countryLayer.Style.EnableOutline = true;
countryLayer.Style.Outline = new Pen(borderColor);
countryLayer.Style.Outline.Width = command.BorderWidth;
countryLayer.Style.Fill = Brushes.Transparent;
var transformationFactory = new CoordinateTransformationFactory();
countryLayer.CoordinateTransformation = transformationFactory.CreateFromCoordinateSystems(
GeographicCoordinateSystem.WGS84,
ProjectedCoordinateSystem.WebMercator);
map.Layers.Add(countryLayer);
var bottomLeft = new Coordinate(command.Extents.BottomLeft.Longitude, command.Extents.BottomLeft.Latitude);
var topRight = new Coordinate(command.Extents.TopRight.Longitude, command.Extents.TopRight.Latitude);
// transformations
var bottomLeftLongLat = countryLayer.CoordinateTransformation.MathTransform.Transform(bottomLeft);
var topRightLongLat = countryLayer.CoordinateTransformation.MathTransform.Transform(topRight);
map.ZoomToBox(new Envelope(bottomLeftLongLat, topRightLongLat));
var img = map.GetMap();
return img;
System.drawing.Graphics
)上绘制图像- 澳大利亚处于中心位置
- 鼠标指针附近的地图层之间存在间隙(屏幕截图中的间隙旨在演示逻辑) 有些国家非常大(例如俄罗斯),并获得信封。中心不会很好地工作-考虑基于最大多边形的定心仅
这是一个样品。在示例中,我使用了来自的地图。地球仪意味着3d地球仪或投影?@Isma no。它在通知中可以与facebook图标相同,但必须包含选定的国家/地区。