lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1846回复:7

地图同步的问题

楼主#
更多 发布于:2007-12-18 00:10
我设计了这样一个简单的MO程序:用户从一副地图上任意选择一个子集,然后对子集中的几个字段进行计算,然后我要把运算结果存储进入原来的地图。可是MO的数据集指针只支持movefirst, movenext,等几个命令,没有moveto,那么我只好遍历所有记录来把地图的指针和子集对应:<br>RstSon:子集的数据集,Rst:map的数据集, ID是对象的唯一编号。<br>do until rst.fields("ID").value=rstSon.fields("ID")<br>if not rst.eof then<br>rst.movenext<br>else<br>rst.movefirst<br>endif<br>loop<br>这个办法在记录少的时候没事,记录多了以后就完蛋:运行时间极其长。<br><br>有简单和高效率的办法吗各位?谢谢先!!!<br>
喜欢0 评分0
lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-12-30 18:10
<P>谢谢!这个思路是查询后定位。</P>
<P>比我原来的好。</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2007-12-29 08:32
<P>可以利用SQL语句来进行查询了,下面是个例子,你可以编写更复杂的sql语句来满足你的查询需要</P>
<P>Private Sub Command90_Click() <BR><BR>Dim critvar As String <BR>critvar = [Forms]![frm Map]![Text94] <BR>Dim serexp As String <BR>serexp = "Usrn = '" + critvar + "'" <BR>MsgBox serexp <BR><BR>Dim recs As MapObjects2.Recordset <BR>Set recs = map1.Layers("gazleedstreets").SearchExpression(serexp) <BR>recs.MoveFirst <BR><BR>Dim selrecs As Object <BR>Dim rect As MapObjects2.Rectangle <BR>Set selrecs = recs("Shape").Value <BR>Set rect = selrecs.Extent <BR><BR>map1.Extent = rect <BR>map1.Refresh <BR>map1.FlashShape selrecs, 3 <BR><BR>End Sub </P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2007-12-28 00:49
<P>No. I am afraid you miss understood my idea. for example, map A is loaded, and user select part of it by a draw tool, I call this set is a "son set". and then user execute a calculation using the field in the son set. when the program close, the son set will expire and the result will disappeal as well, so the user hope to record the results he made in this session to the mother map, to prevent produce to many pieces of files. now, a simple way to do this is to check the ID in the son set and the mother set, in case IDmother=IDson, then the record is the same one and the result could be recorded to the mother set. for reason OM do not have a method "moveto", so the sentence "Place=val(sonRecordset.fields("ID").value): moveto Plance" can't work. alternatively, I have to go round all of the recordset in the mother set, just as I describe in my question, so , anybody can hope me to make a easy way to reach the propose? </P>
<P>thanks again!</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
4楼#
发布于:2007-12-24 16:30
<P>mapobjects的用户现在越来越少了;</P>
<P>好多年没用这个了,不过我觉得你如果是对当前的选择集来进行计算和操作,速度应该不会慢;</P>
<P>你不应该去遍历所有数据</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2007-12-20 23:58
可见我国的GIS水平还是很有一些路程要走呢。或者我宁愿相信大家觉得这个问题太简单不屑於回答。<br><br>但愿!!!<br>
举报 回复(0) 喜欢(0)     评分
lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2007-12-18 17:56
<P>失望啊,1天过去了。</P>
<P>给个说法都成呀!</P>
举报 回复(0) 喜欢(0)     评分
lovebestrong
路人甲
路人甲
  • 注册日期2007-12-16
  • 发帖数8
  • QQ
  • 铜币109枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2007-12-18 01:06
大家快发言啊!
举报 回复(0) 喜欢(0)     评分
游客

返回顶部