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>

发布了32 篇原创文章 · 获赞 0 · 访问量 5万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章