QGeoView - Qt/C ++ widget for visualizing geographic data
-
Qt is a great framework for desktop, mobile and embedded platforms!
However, in QtWidgets, I personally always lacked the solution for displaying geo-referenced data, something very simple to use and enough for visualization of placemarks or heat-maps. An ideal example for me were such solutions as OpenLayers or Google Maps API. I'm familiar with the QtLocation module, but again it is not very suitable for QtWidgets / C++ development, since it is a QML solution more for mobile platforms than for desktop. In general, this was the reason for the creation of QGeoView.QGeoView is a Qt / C ++ widget for visualizing geographic data, like tiled layers, raster or vector data. QGeoView has only Qt as dependency. This component uses QGraphicsView and focuses on usability and performance.
QGeoView public interface follows best practices from OpenLayers and Google Maps API and supports all basic map features, like:- EPSG3857 projection (others can be added)
- Camera changes: scaling, rotation, moving
- TMS (OSM, Google, Bing or custom)
- Map control widgets
QGeoView uses a hierarchical object storage system, which can store both visual objects (for example, raster or shapes) and non-visual objects (for example, a layer of items). Override in paint event for the visual object allow you to show on the map any geo-data from any source (like in QGraphicsView). However, QGeoView itself does not provide methods for reading/parsing of geo-data sources (files). The only exception are TMS servers and bitmap images, for all other sources you need to extend solution.
You can learn more about this project on GitHub (GPL licence). Feedback's and contributions are welcome :)
-
Hi
Nice. Thank you for sharing. -
Hi AmonRaNet,
Interesting project as I don't want to deal with Qt QML Geo Map and I'm searching for a 100% C++/Qt slippy map. I just found your post via Google Images and I share the same opinion as you. I used vtkMap in a previous job post https://github.com/OpenGeoscience/vtkMap but it relies on VTK and it's a pain in the ass to handle 2D elements as VTK uses a 3D space and with new VTK versions it won't display correctly (VTK is really hard to work with).
I forked your project and I hope I will add these features before the end of 2021 :
- Clustering of markers, I have already seen how this can be implemented in vtkMap (I have fixed several issues related to its clustering, you can look at the pull request related to vtkMap or use my fork of vtkMap).
- Coloring a polyline with data (generating new n lines (the follows the same path described by the polyline) for n data then coloring them with a color transfer function), I have made this in vtkMap in my previous job and I think it's a fantastic thing to have in slippy maps.
Later, I will try to add features existing in vtkMap but lacking in your QGeoView : parsing geojson files (will need a 3rd party library to parse JSON), showing a GeoTIFF (needs GDAL as a dependancy IIRC), etc...
I hope there will be other developers who will be motivated by your project. Let's make Qt/C++ great again !
-
Hi.
Great idea. I always happy when somebody want to extend solution. As you can see QGeoView is framework for showing of geo-located data in 2D form, but from other side not provide any data parser. If anybody will attach some solution for this - it will really improve framework. I hope to see some PR from you ;) -
Hi,
I'm a newbie with Qt, and just found today QGeoview. I'd like to use it for a project. There are two issues I'm encountering:
1.- I need to build the project (hence the Qgeoview lib) in qt6.2, but it's failing because there are some deprecations in the mouse wheel funcitonalities. Have you tried to build your code in qt6.2? or do you know how to get passed this issue?:
../../QGeoView/lib/src/QGVMapQGView.cpp:244:46: error: no member named 'pos' in 'QWheelEvent'
mWheelProjAnchor = mapToScene(event->pos());2.- Eventually, I will attempt to build everything in webassembly. Have you tried this before?
Any help would be appreaciated it.
Regards,
Alex.