Hi,
I am working on generating a high resolution, large image from the current map to pass to another part of our application.
I tried to use the PrinterLayerOverlay / PrinterInteractiveOverlay method to start with but I came across a few issues;
- I have to effectively setup a new map with the existing layers inside the PrinterLayerOverlay and move or copy them (re: thinkgeo.com/forums/MapSuite…fault.aspx)
- I have to change the ZoomLevelSet and GeographyUnit of the map to PrinterZoomLevelSet
- I have to change the ZoomLevelSet and GeographyUnit of all of the layers to PrinterZoomLevelSet so that they would display correctly, which would require some infrastructure changes to my layer management
- When I change the ZoomLevelSet it means that the way that zoom level sensitive styles would alter, because the PrinterZoomLevelSet values are much different to the ones that were being used on the map previously
- Since we require a BingMapLayer output too, those zoom scales did work well with this layer
I decided not to go this route for those reasons, although any comments on the points I made would be appreciated in case I missed something simple.
Now I have a RestrictionLayer to show a viewport into the current map that is scaled to the user’s selected output scale and constrained by the physical output size; the amount of space on our page template.
This route seems to work better for our requirements, because I can quickly switch on the RestrictionLayer, allowing the user to move it around, and use that to generate a viewport over the existing layers without rebuilding the map or changing my layer objects.
We require the output to be to any scale the user would like, any physical output size (say, up to A0), and a high resolution (600dpi / 1200dpi because it is for a printed document).
I have a process that takes the Layer objects, adds them to a new MapEngine (the extent is set to the viewport from the RestrictionLayer) and renders them to a Bitmap object (that is the correct output size and resolution).
Issues that I am having with this are;
- Some style are rendered way too large at any resolution higher than 96dpi (almost as if it is coded value somewhere). As a side note, my styles can be defined in terms of DistanceUnit, so you can say that a point is rendered 10 metres in diameter. This affects label size, point outline, area outline, and line thickness (inner). I have come up with a workaround by scaling these parts down based on rendering dpi, but I don’t think it is ideal. Also, I think that maybe this could be something to do with the GeoCanvas that is used when rendering occurs? Should I use another type of GeoCanvas?
- I get OutOfMemoryException or ArgumentException intermittently when generating the final image, which comes at the point where a System.Drawing.Bitmap is constructed. This means that I don’t have enough contiguous memory for that bitmap because it could be very large. I appreciate this is a GDI issue really, but in my main map I think that this problem is masked because I use TileOverlay and it implicitly makes lots of smaller Image objects, which leads my to my point; is there a utility method to tile a Layer without TileOverlay, or is there a way to add a TileOverlay to MapEngine to achieve the same behaviour? (I did spot this (thinkgeo.com/forums/MapSuite…fault.aspx) but would prefer to use a utility method if one exists). This does affect WMS layers too because they may have a maximum size per tile request.
One feature that I would like to try and achieve is this.
I want the map printing to be WYSIWYG, and so I would like for layers to render at the ZoomLevel that the main map is showing rather than the scale of the image that I will generate. Do you have any suggestions to this?
Sorry in advance for such a large message with lots of questions,
Many thanks,
Kris