Issues with maps
-
Hi,
I'm struggling with a problem that I don't know how to solve.
I need to show a google maps in satellite view in a widget.
I tried a lot of different way but I can't find a solution that match my requirements.-
I tried to use QWebEngine that seems to be the better solution, but the problem is that I'm using MinGW Compiler and my app is at an advantage stage, and it gives me problem when trying to compile with MSVC. So I must go on with MinGw.
-
I tried the binaries for QWebKit, but I don't know why it continues to charge the map and after some time that it has been shown the application suddendly crashes. I tried the latest binaries suggeted by @Konstantin-Tokarev in this topic . I ended up here (https://forum.qt.io/topic/85467/google-not-loading-in-qtwebkit/2) where if I understand well, QtWebKit is too old for modern version of Google maps, that is oke, I mean there is a reason if it's been deprecated and Doc says that you shouldn't use it for new application.
-
I tried with QML, using an external libray for google maps but I can't get it working in release mode, probably for setting bad the api key, but since I've always develop using c/c++ I really don't know where to put my hands. This is the topic where I explain better the problem.
At this point if anyone can help with the above problems is welcome.
Anyway I'm also wondering if somebody knows if there is an external library that can help me to work with google maps. Maybe a browser plugin, also that needs license. I have to solve this problem of google maps.
For more specifics my system uses:
- QT 5.9.1
- Windows 10 x64
- MinGw 5.3.0 32bit
Thanks in advance.
-
-
FWIW, Google Maps seem to work fine in QtWebKit here
-
@Konstantin-Tokarev thanks for your answer.
this is my simply code:
.pro
QT += core gui webkitwidgets
.cpp
#include <QtWebKitWidgets> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QWebView *view = new QWebView(this); view->setGeometry(this->geometry()); view->load(QUrl("https://www.google.it/maps")); view->show(); }
In debug mode it stops without showing the window with:
Starting C:\Users\Documents\build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug\debug\untitled1.exe... The program has unexpectedly finished. The process was ended forcefully. C:/Users/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug/untitled1.exe crashed.
in Release mode it show the mainwindow and then it crashes with:
Starting C:\Racer\Documents\build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Release\release\untitled1.exe... libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_server_callback qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_use_psk_identity_hint qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated The program has unexpectedly finished. The process was ended forcefully. C:/Users/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Release/release/untitled1.exe crashed.
I don't know how it works on your side. Any advice?What should I check?
-
@davidesalvetti it looks like you don't have OpenSSL support on the platform your application is running, which is...?
-
@Pablo-J.-Rogina thanks for your answer. What do you mean with platform? I'm using QT 5.9.1 on windows 10 x64.
If the problem is OpenSSL how can I get it?
-
@davidesalvetti said in Issues with maps:
What do you mean with platform?
I mean the OS your application is running on, so you answered Windows 10 x64
You may want to grab OpenSSL binaries here and you'll need files libeay32.dll and ssleay32.dll available, usually same folder as your application executable. -
@Pablo-J.-Rogina I copied the DDLs in this path C:\Qt\5.9.1\mingw53_32\bin .
Now the Application output is this:Starting C:\Users\Documents\build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Release\release\untitled1.exe... libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile The program has unexpectedly finished. The process was ended forcefully. C:/Users/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Release/release/untitled1.exe crashed.
I suppose that the warning "libpng warning: iCCP: known incorrect sRGB profile" is not relevant since it is about png files.
Still crashes somehow, can't understand why. The code is simple, I just show the QWebView. -
Hi,
You should run the debug version and get the stack trace. That will help identify the problem.
-
@SGaist thanks for your answer. In debug mode it doesn't even start:
Starting C:\Users\Documents\build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug\debug\untitled1.exe... The program has unexpectedly finished. The process was ended forcefully. C:/Users/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug/debug/untitled1.exe crashed.
But that's a known issue of QtWebKit, am I wrong?
-
I've done pretty extensive work using Qt mapping functionality. I started with the QML mapping examples and now having this transposed into a QWidgets application - using QML <> C++ function calls to update and retrieve information from the maps. I must admit, I much prefer the ESRI/OpenStreetMaps to GoogleMaps.
I find the QML implementation much faster and smoother than any QWebKit implementation I've come across plus there are signals available for when the map has loaded, etc.
Willing to share code if this would help but I have successfully used the
googlemaps
plugin even though it is 3rd party. -
@webzoid said in Issues with maps:
I started with the QML mapping examples and now having this transposed into a QWidgets application - using QML <> C++ function calls to update and retrieve information from the maps.
It's exactly what I'm looking for!
I must admit, I much prefer the ESRI/OpenStreetMaps to GoogleMaps.
The problem is that I need Satellite view that ESRI doesn't support, am I right? The quality of the ESRI/World Imaginery is not good enough.
Willing to share code if this would help but I have successfully used the
googlemaps
plugin even though it is 3rd party.It would help a lot! Maybe can you share also some code that uses
googlemaps
plugin? It works in debug, but when in release it doesn't show me nothing and says:qrc:/qml/qml/MapTrack.qml:119: Error: Cannot assign [undefined] to QDeclarativeGeoMapType*
But if you see in my code here I use a GroupBox that should give me all the GeoMapTypes, but it gives me none. And this happens only in release, in debug everything works fine.
Thanks a lot for your time.
-
The ESRI map provider does indeed support satellite imagery - I am using this (and all other supported map types) in my end application. I appreciate what you're saying about the quality of the imagery though. Given that we are in the days of 4K, I think Google and the likes need to step up with their map imagery :)
It will take a little while but I'll put together some example code for you which shows the QML stuff working in a QWidgets application.
I think in your case in your QML, the following line is wrong:
onCurrentIndexChanged: myMap.activeMapType = myMap.supportedMapTypes[currentIndex]
Where is
currentIndex
obtained from? Have you tried replacingcurrentIndex
with, say1
just to test that the map type changes? -
Have you tried the qml map viewer example application - it'll show you the available map types for a given provider.
Also, have you checked out the ArcGIS Qt Runtime - https://developers.arcgis.com/qt/
This is something I'm looking to move over to as it seems to be a pretty comprehensive mapping solution
-
@davidesalvetti said in Issues with maps:
But that's a known issue of QtWebKit, am I wrong?
It works fine here, both debug and release. Debug version may crash because of assertion failures on some sites. If program doesn't start, it might be because not all dlls were copied
-
@Konstantin-Tokarev what about this link? I downloaded these binaries https://github.com/annulen/webkit/releases/tag/qtwebkit-5.212.0-alpha2/qtwebkit-5.212.0_alpha2-qt59-mingw530-x86.zip , I extracted the files and I copied DDLs and others files in "C:\Qt\5.9.1\mingw53_32" in the corresponding folders.
The behaviour is that:
- in debug mode is I put this line the program doesn't even start:
QWebView *view = new QWebView(this);
- in release mode, the program starts but while charging the google map it crashes.
My app is minimal, I'm just showing this QWebView. All the DDLs are installed, I've checked. Maybe the binaries are wrong? I don't think so, I'm using qt 5.9.1 with mingw53_32 on Windows 10 x64, they should be correct. What am I missing?
-
Right, it was fixed long time ago. Please use http://download.qt.io/snapshots/ci/qtwebkit/5.212/latest/qtwebkit/ and Qt 5.10
-
@webzoid said in Issues with maps:
The ESRI map provider does indeed support satellite imagery - I am using this (and all other supported map types) in my end application.
What mapType are you using? I have found ESRI/World Imaginary but the quality is a lot worst than google maps.
This is ESRI:
This is google maps:
There is a lot of difference, that's why I need to use google maps plugin. But I don' t understand one thing: did you manage to use googlemaps provider also in release mode? Can you try it?
It will take a little while but I'll put together some example code for you which shows the QML stuff working in a QWidgets application.
Thank you very much, I'll wait your examples :)
I think in your case in your QML, the following line is wrong:
onCurrentIndexChanged: myMap.activeMapType = myMap.supportedMapTypes[currentIndex]
Where is
currentIndex
obtained from? Have you tried replacingcurrentIndex
with, say1
just to test that the map type changes?currentIndex
is a property of groupbox, when in the groupbox you click and change the selected item it refreshes and it uses currentindex. I'm not an expert of QML but in debug mode it works and it works this way. In release mode it doesn't show possible maps type. Maybe do I have to put somewhere the api key?Have you tried the qml map viewer example application - it'll show you the available map types for a given provider.
Yes I tried it, and sinceI added the third party library for google maps it shows me also googlemaps in the provider section. But same story, in debug it works, in release I can't even find it in provider.
-
@Konstantin-Tokarev Ok thanks, but which one should I download? From what I can see for MingGw si only available with windows 7. Does it work also with windows 10?
-
@davidesalvetti Sure, "Windows 7" means only that it was built on Windows 7 machine (same as official Qt binaries)
-
For the answer to this question https://forum.qt.io/topic/90126/problem-with-qml-and-google-maps-plugin/3