Unsolved Open source map plug in for QML
-
Hi,
i tryied the "mapviewer" example and want to use another open source map instead of the "osm" one.
There are only three available Map plugin OpenSource, Mapbox, HERE.
But i want to use this open source map http://openseamap.org
How can i do my own plug in?
Is there a way to do it? -
Hi and welcome to devnet,
Sure you can, take a look at the qtlocation sources, you'll find there osm plugins as well as the others. You can take inspiration from them.
-
@michaelL you cat take a look at my plugins here https://github.com/vladest
-
Hi,
thanks for replay.
I added the osm.mapping.host parameter on the "mapviewer" example with the open sea map:
parameters.insert("osm.mapping.host", "http://tiles.openseamap.org/seamark/");But still i dont see the map.
In the example i go to "MapType" and select "custom URL Map".Any idea?
-
Hi vladstelmahovsky,
how can i use your googlemap plugin in the mapviewer example?
-
@vladstelmahovsky I copied the libqtgeoservices_googlemaps.so into plugins/geoservices among others (osm, mapbox, here). Then I run the sample app MapViewer. MapViewer see the plugin, but it come back say "Set googlemaps.map.apikey with google maps application key, supporting static maps."
Where do I set this apikey?
How do I obtain the key? Does Google issue it?Thanks
-
Nevermind, I solved the problem.
-
@vladstelmahovsky Your plugin works really cool though. I probably will look into source code and make my own to load map locally from file or database
-
@TonyN actually, QtLocation itself handles caching of the data and you can provide your own cache mechanisms, afaik
-
where did you found this file "libqtgeoservices_googlemaps.so" and the "plugins" folder?
I couldnt fin any plugins folder on the Qt installation directory. -
@TonyN i found one plugins folder here C:\Qt\5.6\mingw49_32\plugins\geoservices
But inside there is only .dll files. -
@michaelL you have to build and install the plugin yourself.
-
@SGaist so i build it and install it insite mingw32:
qmake googlemaps.pro
mingw32-make
mingw32-make installAnd when i ran the example the plugin was there but the map didnt came up and gave me this erro message:
QGeoTileRequestManager: Failed to fetch tile (543,298,10) 5 times, giving up. Last error message was: 'Set googlemaps.maps.apikey with google maps application key, supporting static maps'Any idea?
-
@vladstelmahovsky i saw you had the same issue.
i generate my google api key now but i dont know where to put it.
How did you solve it? -
@michaelL well, have you added PluginParameter {} to your google Plugin {} instance with googlemaps.maps.apikey ?
-
@vladstelmahovsky no where do i set this parameter? On the plugin or on the mapviewer example?
-
@michaelL in the mapviewer. something like this:
Plugin {
id: gmapsPlugin
name: "googlemaps"
locales: "en_EN"
PluginParameter {
name: "googlemaps.useragent"
value: "<your user agent>"
}
PluginParameter {
name: "googlemaps.route.apikey"
value: "<put your api key here>"
}
PluginParameter {
name: "googlemaps.maps.apikey"
value: "<put your api key here>"
}
PluginParameter {
name: "googlemaps.maps.tilesize"
value: "256"
}
} -
@vladstelmahovsky On the mapviewer example i tryied on the QML File:
Plugin{
id: myPlugin
name: "googlemaps"
PluginParameter { name: "googlemaps.maps.apikey "; value: "https://maps.googleapis.com/maps/api/js?key=.............; }
}Where "......" my googlemap key is.
But it didnt worked.
-
@michaelL value shold be ONLY api key. not full url. just api key
-
@vladstelmahovsky I tryied the api key only but i got the same error.
Did you do anything else?