问题描述
这是我做轨迹重放的一段程序,本来是要批量输入数据画轨迹,可是在地图上显示不出来,改为画一个点,去掉很多细节也画不出来,程序如下,请大家多多指教:DimXAsDoubleDimYAsDoublePrivateSubBL_Click()CallGPStrackplayEndSubPrivateSubGPStrackplay()DimlyrAsMapXLib.LayerForEachlyrInMap1.LayersIflyr.Name="temtracklayer"ThenMap1.Layers.RemovelyrEndIfNextSetlyr=Map1.Layers.CreateLayer("tmpTrackLayer")'创建轨迹图层SetMap1.Layers.AnimationLayer=lyr'将轨迹图层设为动态图层DimTrackFtrAsMapXLib.FeatureDimpntAsNewMapXLib.PointSetlyr=Map1.Layers.Item("tmpTrackLayer")'通过名称获取图层CallBLtoXYpnt.SetX,Y'读取数组中的经纬度数据SetTrackFtr=Map1.FeatureFactory.CreateSymbol(pnt)'创建点图元lyr.AddFeatureTrackFtr'将点图元添加到轨迹图层EndSubPrivateSubBLtoXY()'经纬度BL换算到高斯平面直角坐标XY,6°分带法'c2以度小数形式输入纬度值,北纬39度54分20秒,输入39.5420'd2以度小数形式输入经度值,东经116度23分29秒,输入116.2329's2计算结果,横坐标x't2计算结果,纵坐标y'投影带号计算 n=[d2/6]+1如:测得经度103.xxxx,故n=[103.x/6]+1=17+1=18'中央经线经度 a2=n*6-3=[c2/6]*6+3Dima2AsDoubleDimb2AsDoubleDimc2AsDoubleDimd2AsDoubleDime2AsDoubleDimf2AsDoubleDimg2AsDoubleDimh2AsDoubleDimi2AsDoubleDimj2AsDoubleDimk2AsDoubleDiml2AsDoubleDimm2AsDoubleDimn2AsDoubleDimo2AsDoubleDimp2AsDoubleDimq2AsDoubleDimr2AsDoubleDims2AsDoubleDimt2AsDoubleDimiAsIntegerc2=Val(txtLat.Text)d2=Val(txtlon.Text)a2=Int(d2/6)*6+3'把a2化成度,dddmmmm(先算7位)b2=Int(a2)+(Int(a2*100)-Int(a2)*100)/60+(a2*10000-Int(a2*100)*100)/3600'将c2,d2化成度,e2=Int(c2)+(Int(c2*100)-Int(c2)*100)/60+(c2*10000-Int(c2*100)*100)/3600f2=Int(d2)+(Int(d2*100)-Int(d2)*100)/60+(d2*10000-Int(d2*100)*100)/3600g2=f2-b2h2=g2/57.2957795130823'经度差化为了弧度i2=Tan(e2/57.2957798130823)j2=Cos(e2/57.2957798130823)k2=0.006738525415*j2*j2l2=i2*i2m2=1+k2n2=6399685.9018/Sqr(m2)o2=h2*h2*j2*j2p2=i2*j2q2=p2*p2r2=(32005.78006+q2*(133.92133+q2*0.7031))s2=6367558.49686*e2/57.29577951308-p2*j2*r2+((((l2-58)*l2+61)*o2/30+(4*k2+5)*m2-l2)*o2/12+1)*n2*i2*o2/2'计算结果,横坐标,xt2=((((l2-18)*l2-(58*12-14)*k2+5)*o2/20+m2-l2)*o2/6+1)*n2*(h2*j2)t2=t2+(Int(d2/6)+1)*1000000+500000'计算结果,纵坐标,y,加上"带号"和"东移"500KMX=s2Y=t2EndSub
解决方案
解决方案二:
程序有调试过么?你可以定位下是不是画的时候点没有写进去,还是啥原因?
解决方案三:
看看你用来画点的图层有没有设置坐标体系和边界范围指定一下坐标体系
解决方案四:
lyr.AddFeatureTrackFtr'将点图元添加到轨迹图层这个之后要update一下!应该就可以了
解决方案五:
对了,同时把地图中心移动到该点,别画到屏幕外
解决方案六:
绘制位置还有刷新