<GDAL_WMS>
<Service name="TMS">
<Version>1.1.3</Version>
<ServerUrl>file:///E:/QGis/chinamap/exp/tiles/${z}/${x}/${y}.png</ServerUrl>
<ImageFormat>image/png</ImageFormat>
</Service>
<DataWindow>
<UpperLeftX>-20037508</UpperLeftX>
<UpperLeftY>20037508</UpperLeftY>
<LowerRightX>20037508</LowerRightX>
<LowerRightY>-20037508</LowerRightY>
<TileLevel>7</TileLevel>
<YOrigin>default</YOrigin>
</DataWindow>
<Projection>WGS84</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>3</BandsCount>
<DataType>byte</DataType>
<ZeroBlockHttpCodes>204,303,400,404,500,501</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMS>
<ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
QgsRasterLayer* layer = new QgsRasterLayer(filename, filename);
if (!layer->isValid())
{
QMessageBox::critical(this, QStringLiteral("错误"), QStringLiteral("初始化图层失败!\n") + filename);
return;
}