Open Street Map and Google Maps™ plugins for Qt Mobility Location API.
Download
git clone git://gitorious.org/qtm-geoservices-extras/qtm-geoservices-extras.git
Build
The recommended way to build the plugins is to used cmake mkdir build && cd build && cmake .. && make
but you can also use qmake qmake && make
.
Documentation
OpenStreetMap (openstreetmap) ============================ API --- OpenStreetMap creates and provides free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive, or unexpected ways. http://openstreetmap.org/ http://wiki.openstreetmap.org/wiki/Tiles Parameters ---------- mapping.servers: type: QString / QStringList default: http://tile.openstreetmap.org/ description: openstreetmap tile server(s) if a list is specified, the manager will used round robin to balance request between servers. The trailing slash is *needed*. Examples: Use two servers: ("http://a.tile.openstreetmap.org/", "http://b.tile.openstreetmap.org/") OpenCycleMaps: ("http://tile.opencyclemap.org/cycle/") mapping.server: alias for mapping.servers mapping.proxy: type: QString default: application global proxy settings description: http proxy used for network queries [host[:port]]. default port is 8080. mapping.cache.directory: type: QString default: temporary directory description: Cache directory. mapping.cache.size: type: long long (or QString) default: default QNetworkDiskCache cache size description: cache size, may be limited by the platform. Google ====== API --- To use this plugin you must read and accept Google's Terms of Use available at: http://code.google.com/apis/maps/terms.html You may not be able to distribute any application using this plugin, it was designed for experimentation only. http://code.google.com/apis/maps/documentation/ Tiles from: http://mt.google.com/vt/lyrs=h@137&x=%1&y=%2&z=%3 (streets) http://mt.google.com/vt/lyrs=&x=%1&s=&y=%2&z=%3 (streets + terrain) http://khm.google.com/kh?v=51&x=%1&s=&y=%2&z=%3 (sat) Parameters ---------- mapping.proxy: type: QString default: application global proxy settings description: http proxy used for network queries [host[:port]]. default port is 8080. mapping.cache.directory: type: QString default: temporary directory description: Cache directory. mapping.cache.size: type: long long (or QString) default: default QNetworkDiskCache cache size description: cache size, may be limited by the platform.
Example
QMap parameters;
parameters["mapping.servers"] = QStringList("http://a.tile.opencyclemap.org/cycle/")
<< "http://b.tile.opencyclemap.org/cycle/"
<< "http://c.tile.opencyclemap.org/cycle/";
if (serviceProvider)
delete serviceProvider;
serviceProvider = new QGeoServiceProvider("openstreetmap", parameters);
if (serviceProvider->error() != QGeoServiceProvider::NoError) {
QMessageBox::information(this, tr("Error"),
tr("Unable to find the %1 geoservices plugin.").arg(providerId));
qApp->quit();
return;
}
mapManager = serviceProvider->mappingManager();