%
' Map Viewer (Third Edition) by Howie Sternberg at howies@snet.net.
' Map Viewer is placed in the public domain and is "Freeware".
' Map Viewer may be freely used and redistributed, is provided "AS-IS"
' without warranty of any kind, and there is no technical support provided.
' -------------------
' Map Image variables
' -------------------
Dim blnLegendAutoExtend ' Map legend autoextend boolean
Dim intLegendColumns ' Number of columns in legend
Dim intLegendWidth ' Map legend width (pixels)
Dim intLegendHeight ' Map legend height (pixels)
' ----------------------------
' Map Image Functions and Subs
' ----------------------------
Sub setLegendSize(iWidth, iHeight, sPlacemement)
Dim sList, aList
Dim aMapLegendParams(2)
aMapLegendParams(0) = Array("width", iWidth)
aMapLegendParams(1) = Array("height", iHeight)
aMapLegendParams(2) = Array("placement",sPlacemement)
sList = transformXMLfromFileWithParameters("xml\properties.xml","xsl\propertieslegendsize.xsl",aMapLegendParams)
'response.write sList
'response.end
aList = split(sList,"|")
blnLegendAutoExtend = aList(0)
intLegendColumns = aList(1)
intLegendWidth = Cint(aList(2))
intLegendHeight = Cint(aList(3))
End Sub
Sub setMapWidth(dMinX, dMaxX, dMinY, dMaxY)
' Calc and return map envelope dimensions
dblMapWidthX = dMaxX - dMinX
dblMapWidthY = dMaxY - dMinY
End Sub
Sub setMapDpi(sApplyPrint, sServiceDpi, iScreenPixelW, dScreenInchW)
' Set DPI to value appropriate for printed map image or image displayed on screen,
' depending on boolean value of appliestoprintedmap map property.
If (Cbool(sApplyPrint)) Then
' 96 = default for map serice (dpi for images printed on paper)
dblMapDpi = sServiceDpi
Else
' 133.3 = 1600 / 12 (dpi for images displayed on screen)
dblMapDpi = Cdbl(iScreenPixelW / dScreenInchW)
End If
End Sub
Sub setMapScale(dMapW, dMapH, iImgW, iImgH, sMapUnits, dMapDpi)
' Calc and return map scale based on largest image dimension
Dim dConstant
If (dMapW > dMapH) Then
dblMapScale = Cdbl(dMapW / iImgW)
Else
dblMapScale = Cdbl(dMapH / iImgH)
End If
Select Case Lcase(sMapUnits)
Case "feet"
dConstant = 12 ' inches per feet
Case "meters"
dConstant = 39.3701 ' inches per meter
Case "decimal_degrees"
dConstant = (39.3701 * 111195) ' inches per degree
End Select
' 100000 = 86.8055555555498 * 96 * 12
dblMapScaleDenominator = dblMapScale * dMapDpi * dConstant
dblMapScaleDenominator = Round(dblMapScaleDenominator)
End Sub
Function getMapScaleDenominator(dMapW, dMapH, iImgW, iImgH, sMapUnits, dMapDpi)
' Calc and return map scale based on largest image dimension
Dim dConstant, dScale
If (dMapW > dMapH) Then
dScale = Cdbl(dMapW / iImgW)
Else
dScale = Cdbl(dMapH / iImgH)
End If
Select Case Lcase(sMapUnits)
Case "feet"
dConstant = 12 ' inches per feet
Case "meters"
dConstant = 39.3701 ' inches per meter
Case "decimal_degrees"
dConstant = (39.3701 * 111195) ' inches per degree
End Select
' 100000 = 86.8055555555498 * 96 * 12
getMapScaleDenominator = dScale * dMapDpi * dConstant
getMapScaleDenominator = Round(getMapScaleDenominator)
End Function
Function getLayerListAXL(aId,aVis)
' Format LAYERLIST element
Dim i, sAXL
sAXL = ""
For i = 0 to Ubound(aId)
sAXL = sAXL & ""
Next
sAXL = sAXL & ""
getLayerListAXL = sAXL
End Function
Function getLegendAXL(sServiceType, sExtend, sCol, sImgW, sImgH, bRefreshMap, aId, aLeg)
' Format LEGEND element
Dim i, sAXL, sSwatchW, sSwatchH
If (strComp(sServiceType ,"imagemapserver",1) = 0) Then
sAXL = "