- QT 5.15.2
- ArcGIS下载
Downloads | ArcGIS Runtime API for Qt | Esri Developer
- ArcGIS安装(略)
- 参考
Display a map | ArcGIS Maps SDK for Qt | Esri Developer
- QT新建工程
步骤1
![](https://i-blog.csdnimg.cn/direct/81cfa6fde4154f4baaaa19cae809ecb3.png)
步骤2
![](https://i-blog.csdnimg.cn/direct/4a0df9b66ef749cfa73685371a969419.png)
步骤3
![](https://i-blog.csdnimg.cn/direct/9d43e3a1cb5a4b4d94ac019fe15ba0cd.png)
步骤4(选择Topographic不需要KEY)
![](https://i-blog.csdnimg.cn/direct/c12ec23cd40344b79b83c89847c35e11.png)
步骤5(必须是MSVC2019 64bit!)
![](https://i-blog.csdnimg.cn/direct/13c8fda5af154be2ba91fe548577a768.png)
步骤6
![](https://i-blog.csdnimg.cn/direct/75b4a85555d44e258c01038fa747c824.png)
- 清理文件
QT新建ArcGIS工程,编译报错:\BookmarkListModel.h:100: error: C2039: "in": 不是 "Esri::ArcGISRuntime" 的成员-CSDN博客
- 下载测试地图数据
https://download.csdn.net/download/quantum7/90369309
- 修改代码
打开文件,修改参考如下:
// Other headers
#include "ArcGISMapDemo.h"
#include "Map.h"
#include "MapGraphicsView.h"
#include "TileCache.h"
#include "ArcGISTiledLayer.h"
#define TPK_FILE "D:\\SVN-WORK\\SourceCode\\ResearchWork\\ArcGISMapDemo\\map-tpk-for-test\\gis.tpk"
using namespace Esri::ArcGISRuntime;
ArcGISMapDemo::ArcGISMapDemo(QWidget *parent /*=nullptr*/)
: QMainWindow(parent)
{
// Create a map using the ArcGISTopographic BasemapStyle
//m_map = new Map(BasemapStyle::ArcGISTopographic, this);
TileCache* tileCache = new TileCache(TPK_FILE, this);
ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(tileCache, this);
Basemap* basemap = new Basemap(tiledLayer, this);
m_map = new Map(basemap, this);
// Create the Widget view
m_mapView = new MapGraphicsView(this);
// Set map to map view
m_mapView->setMap(m_map);
// set the mapView as the central widget
setCentralWidget(m_mapView);
}
// destructor
ArcGISMapDemo::~ArcGISMapDemo() {}