supermap目前不能对接百度地图,可以用google地图或者天地图;
对应的帮助文档中有有这部分的关键示范代码
// GoogleMaps 数据源
case EngineType.GoogleMaps:
//设置 GoogleMaps 数据源连接所需要的参数
datasourceConnectInfo.EngineType = EngineType.GoogleMaps;
datasourceConnectInfo.Password = "Key";
datasourceConnectInfo.Alias = "GoogleMap";
break;
// SuperMapCloud 数据源
case EngineType.SuperMapCloud:
//设置 SuperMapCloud 数据源连接所需要的参数
datasourceConnectInfo.EngineType = EngineType.SuperMapCloud;
datasourceConnectInfo.Database = "D:/Cache";
datasourceConnectInfo.Alias = "SuperMapCloud";
break;
// WMTS 服务
case EngineType.OGC:
// 设置连接 iServer 所发布的 WMTS 服务所需要的参数
datasourceConnectInfo.EngineType = EngineType.OGC;
datasourceConnectInfo.Server = "http://localhost:8090/iserver/services/map-china400/wmts100";
datasourceConnectInfo.Driver = "WMTS"
datasourceConnectInfo.Database = "D:/Cache";
datasourceConnectInfo.Alias = "WMTS";
break;
// 其他类型数据源
default:
break;
}
// 打开数据源
Datasource datasource = workspace.Datasources.Open(datasourceConnectInfo);
if (datasource == null)
{
Console.WriteLine("打开数据源失败");
return;
}
else
{
Console.WriteLine("数据源打开成功!");
}