免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 1797|回复: 0
收起左侧

MapX常见问题解答(1)![文章]

[复制链接]

2072

主题

100000万

铜板

363

好友

地信专家组

每一次的分离都是为了下一次的相聚

Rank: 14Rank: 14Rank: 14Rank: 14

积分
17622

精华勋章宣传勋章爱心勋章组织勋章地信元老灌水勋章荣誉会员勋章活跃勋章贡献勋章

发表于 2009-11-15 16:08 | 显示全部楼层 |阅读模式
MapX常见问题解答(1)![文章]
MapX常见问题解答
1.对栅格图象的支持。
在mapx3.0中对对栅格图象的支持很弱。
            在mapx4.0中对对栅格图象的支持得到增强。支持BMP,GIF,TIF,JPG,PSD,PNG, MrSID file format (*.sid), 网格文件(*.mig)等。但是需要将这些格式的文件现存成*.TAB 才可以调用。
3.关于 Infotip –信息提示。
1.由Map1.InfotipSupport = True设置使能Infotip.
2.由Map1.InfotipPopupDelay = 500 (millisecond)设置延迟时间。
3.由LabelProperties .DataField来设置用做InfoTip的字段
4.如何在MapX下读取属性值。
有三种方法:
1. 由Layer对象的KeyField属性来设立要读取属性值的字段名。
接着,由Feature对象的keyValue读取此行的属性值。
2. 将图层加入到Datasets,  由Dataset对象的Value(x,y)属性,通过设置行号,列号来获得属性值。
3. 将图层加入到Datasets,之后由RowValues(ftr)获取整行的值。
        Dim ds As MapXLib.Dataset, lyr As MapXLib.layer
        Dim ftrs As Features
Dim ftr As Feature
Dim rv As RowValue
Dim rvs As RowValues
Dim DsName As String   ‘数据集名
Dim DsRows As Long, DsCols As Long
Dim i As Long, j As Long
    Set ds = Formmain.Map1.Datasets.Item(DsName)
    Set lyr = ds.layer
   
    Set ftrs = lyr.AllFeatures
   
    DsCols = ds.Fields.Count
    DsCols = DsCols + 1
    DsRows = ftrs.Count
    Grid1.Rows = DsRows + 1
    Grid1.Cols = DsCols
   
    Grid1.Row = 0
    For i = 0 To DsCols - 1
      Grid1.Col = i
      Grid1.Text = ds.Fields.Item(i + 1).Name
    Next i
    Grid1.Col = DsCols - 1
    Grid1.Text = "Fkey"
    lyr.BeginAccess miAccessRead
   
    i = 1
    For Each ftr In ftrs
        Set rvs = ds.RowValues(ftr)
        j = 0
        For Each rv In rvs
          If Not IsNull(rv.Value) Then Grid1.TextArray(i * DsCols + j) = Trim(rv.Value)
          j = j + 1
        Next
        Grid1.TextArray(i * DsCols + j) = ftr.FeatureKey
        i = i + 1
    Next
   
    lyr.EndAccess miAccessEnd
   
    Set ftr = Nothing
    Set ftrs = Nothing
    Set ds = Nothing
    Set rv = Nothing
    Set rvs = Nothing
    Set lyr = Nothing
注意:BeginAccess,以及EndAccess可以明显的提高属性读取的速度。
5.关于查找
两种方式:
1. 使用Find对象的Search方法。在mapx3.5中只能作到完全匹配查找,在MapX4.0中SearchEx方法则可以找到多个匹配的记录,其结果由 FindResult.Matches获取。详细请参看有关Find.SearchEx 方法的文档以及示例。
2. 使用Layer 对象的OBJECT.Search (strWhere)方法。其参数为SQL查询的WHERE子句。例如:
                     Set ftrs = lyr.Search("Character_Name like ""%市""" ;模糊查询
                     Set ftrs = lyr.Search("Character_Name = ""北京市""" ;
                     Set ftrs = lyrUSA.Search("TOTPOP > 1000000"
                     注意:1。字符串外加两个双引号。2。首先将图层加入数据集Datasets 才能使用查询。
6. 自定义范围专题图
Dim ds As New MapXLib.Dataset
Dim thm As New MapXLib.Theme
Set ds = Formmain.Map1.Datasets(ToolBars.Combo2.Text)
Set thm = ds.Themes.add(0, "aa", "aa", False)
thm.Legend.Compact = False
thm.AutoRecompute = False
'thm.ComputeTheme = False
thm.DataMax = 700
thm.DataMin = 100
thm.ThemeProperties.AllowEmptyRanges = True
thm.ThemeProperties.NumRanges = 7
thm.ThemeProperties.DistMethod = miCustomRanges
thm.ThemeProperties.RangeCategories(1).Max = 150
thm.ThemeProperties.RangeCategories(1).Min = 50
thm.ThemeProperties.RangeCategories(2).Max = 250
thm.ThemeProperties.RangeCategories(2).Min = 150
thm.ThemeProperties.RangeCategories(3).Max = 350
thm.ThemeProperties.RangeCategories(3).Min = 250
thm.ThemeProperties.RangeCategories(4).Max = 450
thm.ThemeProperties.RangeCategories(4).Min = 350
thm.ThemeProperties.RangeCategories(5).Max = 550
thm.ThemeProperties.RangeCategories(5).Min = 450
thm.ThemeProperties.RangeCategories(6).Max = 650
thm.ThemeProperties.RangeCategories(6).Min = 550
thm.ThemeProperties.RangeCategories(7).Max = 750
thm.ThemeProperties.RangeCategories(7).Min = 650
'thm.ComputeTheme = True
thm.AutoRecompute = True
thm.Visible = True
7. 用MapX输出表格
用mapx直接输出图象是可以的,但是输出数据,可以有以下两种方式:
          1。输出为文本文件,然后由VB读取
          2。转换为VB中的groud
8. mapxtreme2.0 for NT下,非地球坐标系出现的问题
假设line.tab 地图的投影为非地球坐标系,单位为米,边界为(-40,030.15474,-10,007.53869)(40,030.15474,10,007.53869)。
(1) 对地图的处理。
    a. 文件/另存为,在弹出的另存为对话框上点击投影按钮,确认,弹出边界对话框,将原来的边界值乘以1.609再添入,即 –40030.15474*1.609=-64408.51898。四个边界值作同样处理。
    b.输入文件名如linenew.tab,确认.
(2) 在geoset manager中调入文件linenew.tab.设置其视野范围。如果实际设置为 0 到 0.19,则输入到对话框中时为 0 到 0.19*1.609.但在设置zoom(视野值)时的范围仍为0-0.19.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表