Hi,
Are there any Qt C++ Widgets samples for -
1. Generating offline map for preplanned area and storing it locally
2. Generating offline map on-demand and storing it locally
3. Loading a stored offline map
4. Get GPS coordinates from user inputs like mouse click
Solved! Go to Solution.
The directory with the mmap and various other files is an "unpacked" mobile map package. The constructor to MobileMapPackage takes either the path to a file with .mmpk extension or to the directory of an unpacked mobile map package. https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mobilemappackage.html#MobileMa...
We don't have specific Widgets samples for these, but we have C++ Qt Quick samples. The actual code to perform these is nearly identical (the only difference between Widgets and Qt Quick is MapQuickView and MapGraphicsView class).
Offline map on demand - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Gener...
Preplanned offline map - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Downl...
Load mobile map package - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/OpenM...
Get coordinates from mouse click - connect to the mouse clicked signal (https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mapgraphicsview.html#mouseClic...) and then call screenToLocation to convert the screen point to map point https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mapview.html#screenToLocation
Hi @LucasDanzinger thanks for the response, I was looking for Widgets samples as I didn't want to involve QMLs. Is this actually even possible?
Yes, it's definitely possible. The actual C++ back end code will be nearly identical. You can disregard the QML portions of the samples, as those are just the UI - you'd use Qt Widgets for your UI instead.
Does the GenerateOfflineMap example actually create the .mmpk which the OpenMobileMap_MapPackage example requires..?
Since the GenerateOfflineMap example was generating the files in tmp, I updated the path to a different path on my drive. When I check this path after running the example, there is no .mmpk file in this path. There is a .mmap file in the one of the subdirectories but this does not work with the OpenMobileMap_MapPackage example.
What am I doing wrong here?
The data is available for download on ArcGIS Online. Details are in the sample readme - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/OpenM...
Hi, the details from the sample readme file are only for the Yellowstone map that is in the example. How can I generate this .mmpk file for any other map that I have created on my account in Map Viewer?
Please correct me if I am wrong but I need to have ArcGIS Pro in order to create an .mmpk file for a map that I have created?
You can create a MMPK in Pro.
You can also generate one on-demand from a web map using our OfflineMapTask. This sample demonstrates how to do this https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Gener...
yeah but the on demand web map using the OfflineMapTask gets deleted after the program exits, I would like to store the maps in a location on my hard drive from where I can load them completely offline at a later point.