1,Arcmap导出可视区域地图块vba代码.(以GIF格式为例,ExportMap函数参数用于命名文件)
Function ExportMap(exportFilePath As String) As Integer
Dim pMxDoc As IMxDocument
Dim pActiveView As IActiveView
Dim pExport As IExport
Dim pPixelBoundsEnv As IEnvelope
Dim exportRECT As tagRECT
Dim iOutputResolution As Integer
Dim iScreenResolution As Integer
Dim hDC As Long
Set pMxDoc = ThisDocument
Set pActiveView = pMxDoc.ActiveView
Set pExport = New ExportGIF ‘输出GIF
pExport.ExportFileName =exportFilePath& Right(pExport.Filter, 3)
iScreenResolution = 96
iOutputResolution = 96
pExport.Resolution = iOutputResolution
Dim pExportGif As IExportGIF
Set pExportGif = pExport
pExportGif.CompressionType = esriGIFCompressionLZW
pExportGif.InterlaceMode = False
With exportRECT
.Left = 0
.Top = 0
.Right = pActiveView.ExportFrame.Right * (iOutputResolution / iScreenResolution)
.bottom = pActiveView.ExportFrame.bottom * (iOutputResolution / iScreenResolution)
End With
Set pPixelBoundsEnv = New Envelope
pPixelBoundsEnv.PutCoords exportRECT.Left, exportRECT.Top, exportRECT.Right, exportRECT.bottom
pExport.PixelBounds = pPixelBoundsEnv
hDC = pExport.StartExporting
pActiveView.Output hDC, pExport.Resolution, exportRECT, Nothing, Nothing
pExport.FinishExporting
pExport.Cleanup
ExportMap = 1
End Function
2,可以提高导出地图清晰度的2种方法:
方法一:把导出格式修改成矢量图,
即修改代码行Set pExport = New ExportGIF ‘输出GIF
然后用其他图像软件把该矢量图转成栅格图。
方法二: 把输出分辨率提高,即修改代码行iOutputResolution = 96
然后用其他图像软件把该栅格图转换成原始大小的栅格图。
无论如何,没有人有办法把自己抑或他人的刺拔掉。那是一碰便痛的软肋,