QML Maps
-
wrote on 15 Jul 2016, 07:22 last edited by
Hello!
I used to work with osm map plugin but since 11 july 2016 direct tile access has been discontinued. Now i want to be able to use osm map plugin or another plugin that it is compatible with android and iOS. Is there any solution about my problem? -
Hello!
I used to work with osm map plugin but since 11 july 2016 direct tile access has been discontinued. Now i want to be able to use osm map plugin or another plugin that it is compatible with android and iOS. Is there any solution about my problem? -
wrote on 15 Jul 2016, 08:49 last edited by
So the answer is that there is no plugin in order to have maps in my app? Can you please give me an example of using thunder forest plugin?
Thanks in advance!
-
So the answer is that there is no plugin in order to have maps in my app? Can you please give me an example of using thunder forest plugin?
Thanks in advance!
-
wrote on 20 Jul 2016, 14:55 last edited by
I wrote my own map component. It was hard, but it works. OSM, Google Maps and more are supported
-
wrote on 4 Aug 2016, 09:09 last edited by
Sorry, but in the instruction of open street map plugin I read that I can use a different host and specify my preferred tile server (e.g. mapnik??)
I tried the following solution, but it doesn't work. I do not understand why? It seems that the app continue to use mapquest tiles...
Plugin {
id: myosmplugin
//preferred: ["osm", "nokia", "foo"]
name: "osm"
//required: Plugin.AnyMappingFeatures | Plugin.AnyGeocodingFeatures
PluginParameter{name: "osm.mapping.host"; value: "http://tile.openstreetmap.org"}
//PluginParameter { name: "osm.mapping.host"; value: "http://c.tile.thunderforest.com/outdoors/" }
} -
Sorry, but in the instruction of open street map plugin I read that I can use a different host and specify my preferred tile server (e.g. mapnik??)
I tried the following solution, but it doesn't work. I do not understand why? It seems that the app continue to use mapquest tiles...
Plugin {
id: myosmplugin
//preferred: ["osm", "nokia", "foo"]
name: "osm"
//required: Plugin.AnyMappingFeatures | Plugin.AnyGeocodingFeatures
PluginParameter{name: "osm.mapping.host"; value: "http://tile.openstreetmap.org"}
//PluginParameter { name: "osm.mapping.host"; value: "http://c.tile.thunderforest.com/outdoors/" }
}wrote on 5 Aug 2016, 19:49 last edited by user901735110 8 May 2016, 21:28I was just dealing with this issue and am answering this as the community forums have been quite helpful with my project. If you found the documentation that I read, at http://doc.qt.io/qt-5/location-plugin-osm.html, then it is wrong as of this writing.
It states that "This parameter should be set to a valid server url with the correct osm api and the Map::activeMapType to the corresponding MapType.CustomMap". The Map::activeMapType is a MapType not an integer type, so setting this enumeration did not work resulting in error
Unable to assign int to QDeclarativeGeoMapType*
Digging through the 5.7 source produces (in qtlocation/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp):
if (parameters.contains(QStringLiteral("osm.mapping.custom.host")) || parameters.contains(QStringLiteral("osm.mapping.host"))) { ... m_providers.push_back( new QGeoTileProviderOsm("", nm, QGeoMapType(QGeoMapType::CustomMap, tr("Custom URL Map"), tr("Custom url map view set via urlprefix parameter"), false, false, 8), QGeoTileProviderOsm::TileProvider(tmsServer + QStringLiteral("%z/%x/%y.png"), QStringLiteral("png"), mapCopyright, dataCopyright ))); ... }
There is a Map::supportedMapTypes available of type list<MapType>. On my desktop system, JSON.stringify( supportedMapTypes ) using a Map with an "osm" plugin produces:
{"0":{"objectName":"","style":1,"name":"Street Map","description":"Street map view in daylight mode","mobile":false,"night":false},"1":{"objectName":"","style":2,"name":"Satellite Map","description":"Satellite map view in daylight mode","mobile":false,"night":false},"2":{"objectName":"","style":10,"name":"Cycle Map","description":"Cycle map view in daylight mode","mobile":false,"night":false},"3":{"objectName":"","style":6,"name":"Transit Map","description":"Public transit map view in daylight mode","mobile":false,"night":false},"4":{"objectName":"","style":6,"name":"Night Transit Map","description":"Public transit map view in night mode","mobile":false,"night":true},"5":{"objectName":"","style":4,"name":"Terrain Map","description":"Terrain map view","mobile":false,"night":false},"6":{"objectName":"","style":8,"name":"Hiking Map","description":"Hiking map view","mobile":false,"night":false},"7":{"objectName":"","style":100,"name":"Custom URL Map","description":"Custom url map view set via urlprefix parameter","mobile":false,"night":false}}
Note item "7":{"objectName":"","style":100,"name":"Custom URL Map","description":"Custom url map view set via urlprefix parameter","mobile":false,"night":false} is the "Custom URL Map" from the C++ source.
So, finally, the following code snippet from a simple test app worked (Qt 5.7):
import QtQuick 2.5 import QtQuick.Window 2.2 import QtLocation 5.3 Window { visible: true width: 640 height: 480 Plugin { id: myPlugin name: "osm" PluginParameter { name: "osm.mapping.host"; value: "http://myobfuscatedhost.tld/osm/" } PluginParameter { name: "osm.mapping.copyright"; value: "The documentation is wrong." } } Map { anchors.fill: parent plugin: myPlugin Component.onCompleted: { for( var i_type in supportedMapTypes ) { if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) { activeMapType = supportedMapTypes[i_type] } } } } }
The images displayed by the resulting map have been confirmed to be from the switch2osm test server I setup.
Good luck.
-
@user901735110 Hi and welcome to devnet,
You should open a bug report about this on the bug report sysetm mentioning your findings. You could even fix the documentation itself by submitting a patch for integration.
-
wrote on 15 Aug 2016, 23:34 last edited by
Esri plans on releasing a geolocation provider for Qt Location, and will be discussing it at QtCon this year. I think everyone will be interested to see the basemaps offered, and to take advantage of routing and geocoding as well. If anyone is in Berlin for the conference, I encourage you to attend this session.
-
wrote on 6 Nov 2016, 12:14 last edited by
I wonder is there any progress done on this issue? If yes; may you please guide us how to use OSM with Qt
I run "Places Map (QML)" example to find the ugly error message of discontinued service :(
-
wrote on 6 Nov 2016, 12:30 last edited by
BTW, I found this widget which view OSM but unfortunately it doesn't work under Android and I couldn't find a way to add places in the map
https://github.com/raptorswing/MapGraphics