这个我的访问url
public static string urlFormat = "http://127.0.0.1:80/geowebcache/service/wms?bbox={0},{1},{2},{3}&styles=&Format=image/png&request=GetMap&layers=fsRoads&width={4}&height={5}&srs=EPSG:3857";
这是访问时的坐标转换
ProjectionInfo mercator3857;
ProjectionInfo wgs84Proj;
public GeoserverStaticImageLayer(string geoserverUrlFormat)
{
LegendText = "Geoserver WMS地图";
this.geoserverUrlFormat = geoserverUrlFormat;
mercator3857 = ProjectionInfo.FromEpsgCode(3857);
wgs84Proj = ProjectionInfo.FromEpsgCode(4326);
}
protected override string GetURL(Extent e)
{
var xys_min = new double[] { e.MinX, e.MinY };
var xys_max = new double[] { e.MaxX, e.MaxY };
var z = new double[1] { 0 };
DotSpatial.Projections.Reproject.ReprojectPoints(xys_min, z, wgs84Proj, mercator3857, 0, 1);
DotSpatial.Projections.Reproject.ReprojectPoints(xys_max, z, wgs84Proj, mercator3857, 0, 1);
return string.Format(geoserverUrlFormat, xys_min[0], xys_min[1], xys_max[0], xys_max[1], WindowSize.Width, WindowSize.Height);
//return string.Format(geoserverUrlFormat, e.MinX, e.MinY, e.MaxX, e.MaxY, WindowSize.Width, WindowSize.Height);
}
mapCtrl.ViewExtents = new Extent(103.310147408915, 30.8326236787506, 103.925908194091, 31.104076505169);//都江堰
访问不到瓦片数据 http 错误是:400:请求的水平分辨率:267.75850412617,最佳匹配:305.748113140558超过10%阈值。也许客户端配置了不正确的比例尺(分辨率),或者与GWC中的DPI设置相比已关闭?