Mapbox Maps SDK for Qt compiled under Windows

1. Code https://github.com/mapbox/mapbox-gl-native

2. Compilation steps https://github.com/mapbox/mapbox-gl-native/tree/master/platform/qt

3. Problems encountered:

  1. During the execution of cmake, the curl command will be used to download the required resources, so you need to set the curl path in the environment variable. curl to use the ssl version.

  2. Because of internet speed or unexplainable reasons, it is necessary to use scientific methods to surf the Internet.

  3. If the network is slow, it may cause download timeout. In the file cmake/mason.cmake, find the statement that executes curl, and set the timeout time to be longer.

  4. In the cmake generation project command, add the installation directory of Qt, for example: -DCMAKE_PREFIX_PATH=D:\Qt\Qt5.9.2_3\5.9.2\msvc2015_64.

  5. In the cmake compilation command, the last compiler custom command "-- /m" is deleted, because the compiler does not recognize this command.

  6. The sqlite database is used internally by mbgl, so the location of the sqlite plug-in should be placed correctly. That is, place sqldrivers/qsqlite.dll in the same level directory of exe.
    Otherwise an exception will be thrown at runtime.

  7. Bug modification:
    a. File: asset_file_source.cpp
        Function: acceptsURL
        Reason: If the url length is less than the assetProtocol length (when the url is empty), the array is out of bounds
        the same bug: local_file_source.cpp

  8. Add a token to the main, and the token can be obtained by registering on the mapbox official website.
      // settings.setAccessToken("your token");

  9. Local resources, such as icons, will be loaded at runtime. Resources are managed by Qt's resource file management, and the file is common.qrc of the mbgl-qt project.
    The files referenced in the resource file can be found in the downloaded source code directory.

  10. At runtime, several predefined styles (json strings) will be downloaded using mapbox's webAPI, so you should also pay attention to the way you surf the Internet during runtime.

  11. For the software usage, you can view the event handling function in mapwindow.cpp.

Fourth, with compilation steps
  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325845639&siteId=291194637