mapxtreme3.0下的最简单asp代码的详细介绍
1)使用geoset
<%
Const cMapXCourier = "MapInfo.MapXCourier"
Const cMapXState = "MapX.State.5"
Const cMapXObject = "MapXObject"
Const cMapXCourierObject = "MapXCourierObject"
Set Session(cMapXCourierObject) = Server.CreateObject(cMapXCourier)
Set Session(cMapXObject) = Session(cMapXCourierObject).GetMapXFromBroker("Anqing", 15000)
'set session(cMapXObject) = Session(cMapXCourierObject).GetMapXFromNewServer("HelloWorld")
Session(cMapXObject).ExportMap server.mappath(".")+"/output.gif", 2
'注意要及时销毁对象
Set Session(cMapXObject) = Nothing
Set Session(cMapXCourierObject) = Nothing
%>
<img src='output.gif'>
2)不使用geoset,动态创建图层,生成专题图
<%
Const cMapXCourier = "MapInfo.MapXCourier"
Const cMapXState = "MapX.State.5"
Const cMapXObject = "MapXObject"
Const cMapXCourierObject = "MapXCourierObject"
Dim objDS
Dim strDSName
Dim objLyr
'Get the map object
Set Session(cMapXCourierObject) = Server.CreateObject(cMapXCourier)
set Session(cMapXObject) = Session(cMapXCourierObject).GetMapXFromNewServer("")
'Add the layer
Set objLyr = Session(cMapXObject).Layers.Add("Road_Regular.tab")
'Create the dataset
strDSName = "Road_RegularDS"
set objDS = Session(cMapXObject).datasets.add (miDatasetLayer,objLyr,strDSName)
'add the theme
objDS.themes.add
'Center the map
Session(cMapXObject).Bounds = Session(cMapXObject).Layers.Bounds
Session(cMapXObject).Title.Visible = false
'Export the current map to a JPEG which is type 3 and display on the page
Session(cMapXObject).ExportMap server.mappath(".")+"/output.jpg", 3
'注意要及时销毁对象
Set Session(cMapXObject) = Nothing
Set Session(cMapXCourierObject) = Nothing
%>
<img src='output.jpg'>
</HTML>
本文地址:http://www.45fan.com/bcdm/72633.html