I'd like to inject a chunk of map that I got from OpenStreetMap under the form of an osm file.
From what I've read in the documentation, the Open Street Map Plugin doesn't seem to have any parameter taking a source file as a map. It only works with a server. Problem is I won't have an Internet connection when running my application. I need to use a map internally.
Ditto for Mapbox and HERE plugins.
Is there any other way to do this?
Here is the boilerplate to create a Map:
Plugin {
id: somePlugin
// code here to choose the plugin as necessary
}
Map {
id: map
plugin: somePlugin
center {
latitude: -27
longitude: 153
}
zoomLevel: map.minimumZoomLevel
gesture.enabled: true
}
Update April 2017: QtLocation now supports offline OSM tiles.
See http://doc.qt.io/qt-5/location-plugin-osm.html
As you note, QtLocation currently does not give you the offline option. Also, for basemaps it currently only supports image tiles (not the XML vector OSM data you are talking about).
You have a few alternatives:
In QML: you can use the ArcGIS Runtime SDK for Qt.
Starting from version 10.26 it supports adding custom map layers with offline tiles. You will need to get PNG/JPG tiles of your OSM data first. Here is an example layer that supports OSM slippymap tiles.
In C++: you will find a few options to display vector data that might require or not conversion from the OSM format and more work on your side:
http://wiki.openstreetmap.org/wiki/Libosmscout
https://www.mapbox.com/blog/qmapboxgl/
QGis is made in Qt, as are many other opensource geographic projects, so they might be helpful
Also, don't forget to vote for the issues mentioned above in Qt Bugtracker!
You can generate or download tiles for offline usage. For generating tiles take a look at TileMill or Maperitive. Downloading tiles can be achieved via Marble and various other tools, but please respect the tile server's usage policy! Downloading high zoom tiles causes high load on the tile server because these tiles are usually not cached and need to be rendered on the fly.
Related
I'm currently working on a Qt Quick application that will provide a map viewer for a smallish area (1 square KM or so), the map details for which will be provided in a single geo-referenced image file (GeoTIFF, geo-referenced PDF, ESRI Shape file etc.), along with display of current location, operator identified points of interest etc. It's primarily responsibility is the display of custom maps (as opposed to generic maps retrieved from public map image service providers (OSM, MabBox, ESRI etc)), and it will often be used in areas with limited connectivity
An extensive web search has identified others who have made similar enquiries in the past (here, Qt forums etc), and the general suggestions for solutions are as follows:
ArcGIS Runtime with Qt SDK Doesn't work for me as down the track I'm intending to target an embedded linux device using an ARM processor, and ArcGIS doesn't make source available for cross-compilation for arbitrary targets. They've recently produced an Android release, but nothing for ARM linux in general)
QGIS developer libraries GPL licence not compatible with my commercial development
Use the Qt Location Map component with a local tile server or offline tile collection (some plugins have recently introduced support for this) Seems a bit of a hack, as noted I'm primarily using custom maps, as opposed to offline copies of public map server images, and my images won't be big enough to really warrant tiling otherwise
It would be feasible to develop a Qt Quick component from scratch to do this, but given that the existing Qt Location Map component provides a well defined pre-existing front end interface for everything my map would need to do and has an extendable plugin based architecture, writing a custom Qt Location GeoServices plugin seems the most sensible and elegant way forward.
I've started examining the source code of the existing plugins, but can't shake the feeling that in a world containing 8 billion people, with "nothing new under the sun", this would have been done already if it was a good idea....
Would anyone with more familiarity with the Qt Location module care to comment?
Since geo-referenced images can be arbitrarily large, it is the standard to convert them into a tile pyramid, to be able to efficiently display them on any hardware (at the cost of doubling the size, at worst, depending on how many layers you want).
Even if you would write your own geoservice plugin, you most likely will end up (directly or by using 3rd party code) tiling your geotiff.
This said, QtLocation does allow you to use custom tilesets ( http://doc.qt.io/qt-5/location-plugin-osm.html, look for osm.mapping.custom.host) served in most ways (http, https, file, qrc, etc.).
So go ahead, fire up QGis, install the QTiler plugin, and convert your images.
If you need to serve these pictures over the net directly to the clients (thus needing to do the conversion on the client), you can either see what QTiler does, or build up your gdal pipeline (gdal_translate, gdalwarp and gdal2tiles), and ship the relevant gdal bits with your application.
If you need multiple images at the same time, you can either use multiple Plugin elements with different plugin parameters, or you can fork the osm plugin and support multiple custom hosts.
Based upon Paul's response, and a couple of similar responses to the same enquiry on Qt forums and mailing lists, plus my own investigation, I'd conclude the following:
Generating a custom Qt Location GeoServices plugin to directly provide map imagery from a geo-referenced image file would not be a great idea as the implementation would be less than straightforward, and in practice any non-trivial map image would likely be large enough that an initial tiling step, followed by use of one of the standard tiled mapping plugins referencing a local tile set would be more appropriate anyway.
Is there a lib outside of mapbox gl for loading the tiles of a giving bbox and zoom level?
i've created some tilesets and styles in Mapbox and want to load it in other viewers (cesium, google maps,...)
I only have min, max lonlat and a z-level and need
to load the specific tiles at the abstraction for the z-level
iterate over the features
get the geometry of the features in wgs84
#csdev. Thanks.
Yes i know there are other implementations in other viewers (ol3, leflet). But i'm not searching for a viewer, only for a framework which service the logic for loading and unloading vector tiles by given bboxes. Because i need it especially for cesium.
I see that there is a possibility to combine ol3 and cesium (ol3-cesium). But i think i will lose at this point functionality of cesium.
mapbox-gl-js is the native library for interacting with mapbox vector tiles - the linked docs show it is build on web-gl, like cesium.
Regarding other libraries:
Leaflet has plugins for showing your mapbox vector tiles - some listed on the site only work on older versions of Leaflet, some only newer.
Similarly, OpenLayers added support for vector tiles, and different examples out there work only with different versions of OpenLayers - their official site has two examples that work with the current version 3.20.
Esri is rolling out their vector tile implementation right now, and there are posts in esri forums from last year explaining specifically about how to utilize mapbox vector tiles using their javascript api.
All of those libraries let you do what you are asking - load the mapbox vector tiles, process features and attributes, and work in different projections.
Edit: (can't post comments yet) - OK, your question says (cesium, google maps,...) so I wasn't sure what was implied by the ellipses. I will add that at least one of the leaflet plugins, and some of the solutions I have seen out there in adapting vector tiles for openlayers or leaflet utilize the mapbox-gl-js library to load and parse vector tiles, then adapt the data for the viewer in question. Obviously if you write a custom solution for cesium an approach like that is possible, and that both libraries are web-gl based is a positive thing. However, I have not done it myself so no more to add. I'm sure you googled 'mapbox cesium' so found things like the recent google post about incorporating MB tiles to cesium, and some built-in cesium classes related to mapbox. All good places to start.
Edit Lastly, I'll say that you might want to be looking at the various libraries that are part of the mapbox vector tile ecosystem - so this library, for example, might be as close as you will get to what you want at present without requiring you to go down to the web-gl level for a custom solution: mapbox vector-tile-js
HERE maps for certain city like Chennai, India is very limited. I understand that lot of information can be added so that it will benefit end-user.
My question, can I create a new map using HERE and allow my version of maps to be downloaded? If yes? How can I do this
HERE Maps is a proprietary software so you can not try to recreate your own version of it. Trying to recreate a Map API by yourself is a cool idea, but it is also a good idea to build something on top of a technology or an application that is already existing. There are other Map API's out there like OpenStreetMap and Google Maps that allows user to create and add data about POIs (Point of Interests) and/or locations. The data on these apps are also open source, that is why the community are encouraged to contribute data of their own on top of the Application.
TIP: If you are really onto it here is a page that documents the stuffs the happened behind the scenes in developing the HERE Maps: http://360.here.com/2014/12/11/video-craft-science-behind-maps/
Any world map that are available offline without connecting to the net ?
and have the ability to add pins or color etc....
In short, would like to use the application in a internal wiki but cannot find anything that isn't connected to the net.
I think you're searching for something like jVectorMap.
There are many options if you look at OpenStreetMap. The OpenStreetMap-Wiki is quite helpful for finding suitable stuff.
Check: Offline Openstreepmap Wikipage
Or maybe directly OpenStreetMap in a Box
It all depends on how much effort you are willing to put into this.
You can setup your own internal render server or you can just use prerenderd map tiles.
Do you want slippy maps (use open layers!) or just some static images (download map tiles using Mobile Atlas Creator)?
I want to have a vector layer of the world, which shows the country borders, states and their names in English. Is there a layer that exists that I can control the colours?
Cloudmade doesn't let me quite do this, nor does openstreetmap and a bunch of others. I'm thinking I might need to create a raster image and overlay that except I dont know where to get an accurate EPS/vector map I can edit and overlay.
Running out of options!
You have different options depending of your needs:
The easiest one is to use a public
WMS service that offers the
information you need. You can check
catalogues like this one or a
Google search like this. If
your are lucky to find a service
that suits you, just add it as a WMS
layer in OpenLayers as described in
this example.
If you can't find a public service, you will have to serve the
geographic data yourself. You have
to find a dataset of the world
countries (the most common formats
are ESRI shapefile and KML).
If you find a shapefile (try here), you will
have to serve it via a map server like
MapServer or Geoserver.
Both are pretty straightforward to
set up, but choose the one that suits you best (MapServer is a CGI and Geoserver is Java-based). Once you have configured a WMS service with the countries data, you can add it to your OpenLayers app following the previous example.
If you can't or don't want to use a map server and you have a KML file of the world countries, you can also add a vector layer to OpenLayers from a KML file, as described in this example. Be careful, because all geometries will be rendered in the user's browser (with SVG or VML) and for large datasets, this can be a performance issue. Check this example to see it in action.
I hope this give you a few clues.