在VB+mapx中,怎样通过已知的经纬度在图层中标注出来,用怎样的语句表述,我是新手,希望讲的清楚一点~
展开全部
标注出已知的经纬度,首先要新建一个临时图层,然后用已知的经纬度建立一个点图元,然后把点图元插入到临时图层里,这样在地图上就显示出来了。我给你2个代码,一个是添加创建临时图层,一个是根据经纬度添加图元,不过是c#+mapx的代码,你要转成vb的才能用。
//创建临时图层
private void CreateTempLayer()
{
MapXLib.LayerInfoClass gpsInfo = new MapXLib.LayerInfoClass();
MapXLib.FieldsClass newField1 = new MapXLib.FieldsClass();
newField1.AddStringField("GeoName", 20, false);
gpsInfo.Type = MapXLib.LayerInfoTypeConstants.miLayerInfoTypeTemp;
gpsInfo.AddParameter("Name", "temp");
gpsInfo.AddParameter("Fields", newField1);
axMap1.Layers.Add(gpsInfo, 1);
}
//根据经纬度创建点并加入临时图层
double x = Convert.ToDouble(dr.GetValue(4));
double y = Convert.ToDouble(dr.GetValue(5));
int cstate = Convert.ToInt32(dr.GetValue(3));
//插入点
//axMap1.CenterX = x;
//axMap1.CenterY = y;
MapXLib.Point poi = new MapXLib.Point();
poi.Set(x, y);
MapXLib.Style sty = new MapXLib.Style();
sty.SymbolType = MapXLib.SymbolTypeConstants.miSymbolTypeBitmap;
if (cstate == 0)
{
sty.SymbolBitmapName = "PIN1-32.BMP";
}
else
{
sty.SymbolBitmapName = "PIN2-32.BMP";
}
sty.SymbolBitmapSize = 32;
sty.SymbolBitmapTransparent = true;
MapXLib.Feature ftr = axMap1.FeatureFactory.CreateSymbol(poi, sty);
ftr.KeyValue = cstate.ToString() + "|" + dr["CID"].ToString();
MapXLib.Layer lay = axMap1.Layers._Item("temp");
axMap1.AutoRedraw = false;
lay.Editable = true;
lay.AddFeature(ftr, new MapXLib.RowValues());
//lay.Refresh();
axMap1.AutoRedraw = true;
lay.Editable = false;
//创建临时图层
private void CreateTempLayer()
{
MapXLib.LayerInfoClass gpsInfo = new MapXLib.LayerInfoClass();
MapXLib.FieldsClass newField1 = new MapXLib.FieldsClass();
newField1.AddStringField("GeoName", 20, false);
gpsInfo.Type = MapXLib.LayerInfoTypeConstants.miLayerInfoTypeTemp;
gpsInfo.AddParameter("Name", "temp");
gpsInfo.AddParameter("Fields", newField1);
axMap1.Layers.Add(gpsInfo, 1);
}
//根据经纬度创建点并加入临时图层
double x = Convert.ToDouble(dr.GetValue(4));
double y = Convert.ToDouble(dr.GetValue(5));
int cstate = Convert.ToInt32(dr.GetValue(3));
//插入点
//axMap1.CenterX = x;
//axMap1.CenterY = y;
MapXLib.Point poi = new MapXLib.Point();
poi.Set(x, y);
MapXLib.Style sty = new MapXLib.Style();
sty.SymbolType = MapXLib.SymbolTypeConstants.miSymbolTypeBitmap;
if (cstate == 0)
{
sty.SymbolBitmapName = "PIN1-32.BMP";
}
else
{
sty.SymbolBitmapName = "PIN2-32.BMP";
}
sty.SymbolBitmapSize = 32;
sty.SymbolBitmapTransparent = true;
MapXLib.Feature ftr = axMap1.FeatureFactory.CreateSymbol(poi, sty);
ftr.KeyValue = cstate.ToString() + "|" + dr["CID"].ToString();
MapXLib.Layer lay = axMap1.Layers._Item("temp");
axMap1.AutoRedraw = false;
lay.Editable = true;
lay.AddFeature(ftr, new MapXLib.RowValues());
//lay.Refresh();
axMap1.AutoRedraw = true;
lay.Editable = false;
展开全部
是27.4和58.9吧,因为是最小的单位了,所以保留的位数可能需要多一位吧,这个看你用什么作图软件了,建个新图层,你自己投进去就可以了啊,用Mapgis估计比较方便吧,上面会显示你点的坐标的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
想学VB就去华中红客安全网看看吧 能教你蛮多东西
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询