谢谢大家帮帮小弟的忙吧,我刚弄这个.也不知道怎么在地图上任意一处添加一张图片.请大家帮帮忙!有代码最好了,呵呵:)
------解决方案--------------------
渲染 用图片样式渲染
------解决方案--------------------
这个图片要存在前台还是后台??后台可以考虑楼上的,如果是在前台那么直接动态的添加<img>然后定位在你
鼠标点击的位置不就ok了
------解决方案--------------------
用的什么GIS平台啊?
------解决方案--------------------
//创建主地图临时层
private void CreateMainTempLayer()
{
MapXLib.LayerInfo li = new LayerInfo();
MapXLib.Fields flds = new Fields();
flds.AddStringField("ID",20,1);
li.Type = LayerInfoTypeConstants.miLayerInfoTypeTemp;
li.AddParameter("NAME","tempLayer");
li.AddParameter("Fields",flds);
li.AddParameter("AutoCreateDataset",1);
li.AddParameter("datasetname","ds1");
mainMap.Layers.Add(li,1);
}
创建位图图元:
public static void CreateCarFtr(AxMapXLib.AxMap mainMap)
{
MapXLib.Point pnt = new MapXLib.Point();
MapXLib.FeatureFactory feaFac;
MapXLib.Layer lyr;
MapXLib.Feature ftr;
MapXLib.Style style = new Style();
MapXLib.Dataset ds;
MapXLib.Fields flds;
MapXLib.RowValuesClass rows = new RowValuesClass();
lyr = mainMap.Layers._Item("tempLayer");
ds = lyr.DataSets._Item(1);
flds = ds.Fields;
feaFac = mainMap.FeatureFactory;
style.SymbolType = SymbolTypeConstants.miSymbolTypeBitmap;
style.SymbolBitmapSize = 20;
style.SymbolBitmapTransparent = true;//图空白部分显示为透明
mainMap.AutoRedraw = false;
lyr.Editable = true;
for (int i = 0; i < Define.dtCarInfo.Rows.Count; i++)
{
double log;
double lat;
string deviceID;
log = (double)Define.dtCarInfo.Rows[i]["GDevS_Longitude"];
lat = (double)Define.dtCarInfo.Rows[i]["GDevS_Latitude"];
deviceID = Define.dtCarInfo.Rows[i]["GDevS_DeviceID"].ToString();
pnt.Set(log,lat);
style.SymbolBitmapName = "TRUC2-32.BMP";
ftr = feaFac.CreateSymbol(pnt, style);
lyr.KeyField = flds._Item(1).Name;
ftr.KeyValue = deviceID;
lyr.AddFeature(ftr, rows);
lyr.Refresh();
}
lyr.Editable = false;
mainMap.AutoRedraw = true;
}
我这里面是从数据库读取 点数据 每个点创建一个图的,具体的你慢慢参考,给分吧谢谢!
------解决方案--------------------
学习一下