Hi,
I’m playing with PrintPreview sample.
Now I’m wondering what to do to get an exact PrintOut at Scale 1:10.000 on Paper/PDF?
I have a PostGIS-Table with one geometry (Polygon 1.000 x 1.000 Meters).
Projection is EPSG 25832.
I have changed the example as follows:
private void AddMapLayer()
{
// Create the MapPrinterLayer and set the position
MapPrinterLayer mapPrinterLayer = new MapPrinterLayer();
mapPrinterLayer.MapUnit = GeographyUnit.Meter;
mapPrinterLayer.BackgroundMask = new AreaStyle(new GeoPen(GeoColor.StandardColors.Black, 1));
mapPrinterLayer.Open();
// Set the maps position slightly below the pages center and 8 inches wide and 7 inches tall
RectangleShape pageBoundingbox = GetPageBoundingBox(PrintingUnit.Inch);
mapPrinterLayer.SetPosition(8, 7, pageBoundingbox.GetCenterPoint().X, pageBoundingbox.GetCenterPoint().Y + 1, PrintingUnit.Inch);
// Setup the intial extent and ensure they snap to the default ZoomLevel
ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
// Add the MapPrinterLayer to the PrinterInteractiveOverlay
PrinterInteractiveOverLay printerInteractiveOverLay = (PrinterInteractiveOverLay)winformsMap1.InteractiveOverlays["PrintPreviewOverlay"];
printerInteractiveOverLay.PrinterLayers.Add("MapLayer", mapPrinterLayer);
//####################################################################
PostgreSqlFeatureLayer newLayer = new PostgreSqlFeatureLayer();
newLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
newLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.SimpleColors.Red, 2);
newLayer.GeometryColumnName = "the_geom";
newLayer.ConnectionString = "Server=localhost;User Id=postgres;Password=gisme;DataBase=cuxhaven";
newLayer.FeatureIdColumn = "gid";
newLayer.TableName = "atest";
newLayer.Name = "test";
newLayer.Srid = 25832;
Proj4Projection layerProjection = new Proj4Projection();
layerProjection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();
layerProjection.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(25832);
layerProjection.Open();
newLayer.FeatureSource.Projection = layerProjection;
newLayer.Transparency = 255;
newLayer.Open();
mapPrinterLayer.Layers.Add(newLayer);
mapPrinterLayer.MapExtent = newLayer.GetBoundingBox();
//####################################################################
}
When printing to PDF the Polygon width will be 169,07 mm on ANSI A.
Question:
How to set the extent/scale of winformsMap to get a correct printing result at a scale 1:10.000 or any other scale as PDF and Paper?
Regard
Hardy