MapWinGIS:AxMap SnapShot2

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy


Exports the map or a rectangular subregion of the map to an image. The extent and resolution of the image can be specified. In order to specify the image extents for the SnapShot2 function, there are two options:

VB.NET Usage

Function SnapShot2(ClippingLayerNbr As Integer, Zoom As Double, pWidth As Integer) As Object


ClippingLayerNbr The integer layer handle of the map layer. The extents of the exported image will be the same as the layer's extents.
Zoom Double - Set this value to 1.0
pWidth The width of the exported image in pixels. This parameter controls the resolution of the exported image. The value should not be greater than 3000.
Return Value Object - A MapWinGIS.Image object. This image can be saved to various image file formats.

VB.NET Sample Code

 'This code exports the current map view to an image with a width of 2000 pixels.
     'In the code, mainMap is the MapWindow 4 ActiveX map control.
     Private Sub CreateSnapShot2()
         Dim tempFileName As String = "c:\temp\Snapshot2.shp"
         Dim ImageWidth As Integer = 2000
         Dim tempShapefile As New MapWinGIS.Shapefile()
         'This is a temporary shapefile which outlines the extent of the snapshot
         If Not System.IO.File.Exists(tempFileName) Then
             tempShapefile.CreateNew(tempFileName, MapWinGIS.ShpfileType.SHP_POINT)
             'The temporary shapefile should also have at least one field
             Dim myFld As New MapWinGIS.Field
             myFld.Name = "Name"
             myFld.Type = MapWinGIS.FieldType.STRING_FIELD
             myFld.Width = 50
             Dim fldIndex As Integer = 0
             tempShapefile.EditInsertField(myFld, fldIndex, Nothing)
             tempShapefile.StopEditingShapes(True, True, Nothing)
         End If
         'Add the shapefile to the map as a temporary map layer
         Dim myHandle As Integer = mainMap.AddLayer(tempShapefile, True)
         'The extents of the current map view in projected coordinates
         Dim mapExtents As MapWinGIS.Extents = mainMap.Extents
         'Point located at bottom left corner of map view
         Dim myShape1 As New MapWinGIS.Shape
         Dim myPoint1 As New MapWinGIS.Point
         myPoint1.x = mapExtents.xMin
         myPoint1.y = mapExtents.yMin
         myShape1.InsertPoint(myPoint1, myShape1.numPoints)
         'Point located at top right corner of map view
         Dim myShape2 As New MapWinGIS.Shape
         Dim myPoint2 As New MapWinGIS.Point
         myPoint2.x = mapExtents.xMax
         myPoint2.y = mapExtents.yMax
         myShape2.InsertPoint(myPoint2, myShape2.numPoints)
         'Add the two corner points to the temporary shapefile
         tempShapefile.EditInsertShape(myShape1, tempShapefile.NumShapes)
         tempShapefile.EditInsertShape(myShape2, tempShapefile.NumShapes)
         tempShapefile.StopEditingShapes(True, True)
         'The map.Redraw() method must be called before executing Snapshot2
         'Execute the Snapshot2 Function
         Dim myImage As MapWinGIS.Image
         myImage = mainMap.SnapShot2(myHandle, 1.0, ImageWidth)
         If Not myImage Is Nothing Then
             myImage.Save("c:\temp\snapshot2.bmp", True)
         End If
         'Remove temporary layer from the map and clear shapes in temporary shapefile
         Dim shp As Integer = 0
         For shp = 0 To tempShapefile.NumShapes
     End Sub

C# Usage

Object SnapShot2(int ClippingLayerNbr, double Zoom, int pWidth)


ClippingLayerNbr int
Zoom double
pWidth int
Return Value Object

C# Sample Code

VB 6 Usage

Function SnapShot2(ClippingLayerNbr As Long, Zoom As Double, pWidth As Long) As Object


ClippingLayerNbr Long
Zoom Double
pWidth Long
Return Value Object

VB 6 Sample Code

Back to MapWinGIS.Map

Retrieved from ""

This page has been accessed 1,835 times. This page was last modified on 22 February 2009, at 06:34.