I need to include offline tiles (slippy map) into a Qt/Qml mobile application that mainly runs on Android and iOS.
The only well-documented and working solution I found is the commercial Esri Arcgis Runtime for Qt. However, creating tile packages requires using the Arcgis stack, either desktop or server (please correct me if I am mistaken).
https://developers.arcgis.com/qt/
I am looking for an open source and easy to use alternative.
QtLocation has just been improved in Qt 5.5, but there seems to be no out of the box solution for offline tile packages there:
http://doc-snapshots.qt.io/qt5-5.5/qtlocation-index.html
I know this answer is late, but I had the same challenge with client supplied offline maps on Linux
You need to create the directory structure for your map tiles. As I used openstreetmaps I copied the directory structure that they use i.e. root/zoom_level/area_level_1/area_level_2/tile.png
e.g. :
~/osmTiles/12/3820/2078.png
I used marble (https://marble.kde.org/install.php?) to download the map tiles into the correct directory tree (cached), which I then copied to the target hardware and replaced the osm tiles with the client's .png files
I then used npm from node.js to install http-server and hosted the root tile directory as an http server at http//localhost:port (this answer explained it very well: https://stackoverflow.com/a/12905427/5452614)
e.g. :
http-server ~/osmTiles -p 8080
which served osmTiles on http//127.0.0.1:8080
finally I modified the standard QML Plugin thusly
Plugin {
id: osmPlugin
name: "osm"
PluginParameter { name: "osm.useragent"; value: "My Company Name" }
PluginParameter { name: "osm.mapping.host"; value: "http://127.0.0.1:8080/" }
PluginParameter { name: "osm.mapping.copyright"; value: "MyCompany" }
}
where I told QML where to look for my offline tiles. I had to specify that the map should be a custom map, which was harder. Through trial and error I found that supportedMapTypes[7] is custom map. I don't know why, but that's just how it worked out
Map{
plugin: osmPlugin
activeMapType: supportedMapTypes[7]
}
#Marco Piccolino, following our conversation from this other thread, here's the detailed workaround I've found so far, using only QtLocation, an offline tile cache, and a simple http server:
You need to place your png tiles into a folder tree like this: ".../tiles/1.0.0/sat/{z}/{x}/{y}.png", cf this link
You have to run an http server on that folder (you might want to use this command: sudo python -m SimpleHTTPServer 80)
You will have to edit your hosts file to map the following domain to your server's IP address (most probably 127.0.0.1): otile1.mqcdn.com. This trick is quite dirty but as this url is hardcoded inside the QtLocation OSM plugin we don't really have much of a choice with the current available QML API.
Finally the easiest part, in the QML code you should have something like this:
Plugin {
id: mapProvider
name: "osm"
}
Map {
anchors.fill: parent
plugin: mapProvider
gesture.enabled: true
activeMapType: supportedMapTypes[1]
}
Using offline maptiles is now possible through the ArcGIS Runtime library, starting from version 10.2.6:
https://developers.arcgis.com/qt/qml/api-reference/class_tiled_map_service_layer.html
Related
Artifactory seems to automatically generate properties for RPMs, Python wheels etc. Can I extend this function for my own file formats?
I've read the documentation and this talks about the REST API etc but I want to have Artifactory pull properties straight out of the file that I'm uploading.
None yet - I'm asking how.
The logic that automatically generates properties for RPMs etc is hardcoded into each package type Artifactory supports, and you can't add custom repository types.
What you can do is write a user plugin which runs whenever a file is uploaded, reads the file, and adds the appropriate properties. For example:
storage {
afterCreate { item ->
if (!item.isFolder() && item.name.endsWith(".customext")) {
def fstream = repositories.getContent(item.repoPath).inputStream
// read fstream and generate properties
repositories.setProperty(item.repoPath, propName, propVal)
}
}
}
Some notes:
The language is Groovy. If you aren't familiar with Groovy, in a pinch you can pretend it's Java, since most Java is also valid Groovy.
User plugin documentation is here
User plugin API Javadoc is here
For reference, the officially supported plugins are all here
For reasons of security I cannot use the cloud connector in conjunction with the on premise system which we have. Never the less I am very comfortable using WebIDE in order to create the necessary applications. I create the applications in WebIDE using a .edmx file which represents the on premise ODATA service which i plan to use.
After the application is made. I import the archive and then make necessary modifications to the archive in HANA Studio (inside Java EE perspective).
I am doing things according to this guide: https://www.sap.com/developer/tutorials/hcp-webide-switch-live-odata.html
My understanding is that the manifest.json and neo-app.json are both to be modified pointing to the real ODATA service.
In the manifest.json:
According to the guide above, within the neo-app.json, I need to point it to the gateway.
Here is the information of our on premise system.
System Name: sapewp01.xxxxx.com
localURI: /sap/opu/odata/sap/zbw_odata_q3_srv/
Port: 8012 (i assume, the odata service link works on my end)
SAP Gateway (sapgw12)
Another other required information can be provided on request.
How does one change a web ide app to be able link into an on premise ODATA service, WITHOUT disrupting all the work done on webIDE?
In the sap.app part of the manifest.json can't you just specify?
"dataSources": {
"myService": {
"uri": "/sap/opu/odata/sap/zbw_odata_q3_srv/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
At least with my experience working in Eclipse, all I had to do was have the URI to create the model.
oModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, oConfig);
but this was using a legacy app, maybe Web IDE does it a different way?
I'm currently working on a package for Meteor that includes a build plugin. I need to access configurations from the settings file.
However Meteor.settings doesn't work (Meteor is not defined) and process.env.METEOR_SETTINGS also doesn't exist.
Is there any way for my plugin to access the settings file?
It appears that despite the documentation discussing the use of --settings, it doesn't work in a production environment, as often command line options are not available.
So the solution is to use environment variables, which are available only on the server.
server code, meteor methods:
eor methods
Meteor.methods({
getPJS: function() {
return process.env.PEERJS_SERVER;
},
client code
var PJS = Meteor.call("getPJS");
So you can make those environment variables available on the client if you need them.
Is it possible to set quality for png images on ezpublish 2014.11 in `image_variations' config.
I'm looking for something like this :
media:
reference: null
quality: 50
filters:
- { name: geometry/scalewidthdownonly, params: [100] }
I found ezpublish doc on alias, but it seems limited to jpeg.
I found jpegoptim liip post processor, but liip imagine doesn't seems to have an optipng post processor.
So my guess is that I'll have to build my own post processor based on the jpegoptim one.
Any simpler solution ?
These rather new liip imagine bundle setting / feature(s) are not supported 'directly' (today) in eZ Publish 5.4 (Community Build 2014.11 or latest composer / GitHub sources).
This has been discussed previously: http://share.ez.no/forums/ez-publish-5-platform/ez-5.4-image-variations-jpeg-quality
http://share.ez.no/forums/discussions/new-in-ez-5.4-image-alias-system-revamped/(order)/latest
Rumor has it that this will be addressed in the future but no specific commitments have yet been publicly made. There is an existing issue ticket for this concern: https://jira.ez.no/browse/EZP-24167
A user did find a partial work around that they shared as helpful but not quite perfect: http://share.ez.no/forums/ez-publish-5-platform/ez-5.4-image-variations-jpeg-quality/comment86157
Easy way to handle developemnt/production URLs in flex air app? I want to point to my local box for testing, but when I launch I want it to automatically point to the production URL.
You can use namespaces and configure the current namespace (DEV/RELEASE) in your compiler options.
CONFIG::release
public function connect()
{
//connect to release url
}
CONFIG::dev
public function connect()
{
//connect to dev url
}
then define these options for the compiler:
-define=CONFIG::release,false
-define=CONFIG::dev,true
I suggest either using a configuration file or changing your hosts file to point domains to localhost or dev servers on your development machine. With the latter option you always use your production URLs in code, but your dev machine will resolve those domains to your local machine because it checks the hosts file first.
The best approach here is to externalize this information into a config file - perhaps an XML file - that is loaded via a relative url. The config file might like look this:
<config>
<serviceEndpoint>http://www.mydomain.com/services</serviceEndpoint>
</config>
Be sure to name your XML elements with valid ActionScript variable names or you may encounter some difficulty working with the file (for instance, E4X expressions may become difficult.
You can then use HTTPService to load "config.xml" which is placed alongside your application's SWF when deployed. This will allow you to repoint a SWF hosted on any domain to backend hosted anywhere else. This is especially useful if you are developing locally and are connecting to a shared development server.
Compiling this information into your SWF is very inflexible and a poor practice.
I typically will look at the url in the contentLoaderInfo object in either the Application (Flex -- http://livedocs.adobe.com/flex/201/langref/mx/core/Application.html#url) or root display object (Flash -- http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html#url). If the url begins with "file", you know you are in your development/IDE, if it's "http", it's being run in a browser. If you're just working in the browser, you might also pass a parameter to the object that has something like
{
url: $_SERVER['SERVER_NAME'];
}
and perform some init/startup method to switch based on the path the app is running under.
I had this very issue in an AIR app I am writing that hits a Rails app via WebORB.
I just need to switch between http://localhost and http://fakeproductionurl.com depending on whether I was running in Flex Builder (via adl).
This is what I ended up using:
if (NativeApplication.nativeApplication.publisherID != "") {
return "http://fakeproductionurl.com";
}
else {
return "http://localhost";
}
It doesn't give you the ability to switch between 3+ different environments, but it's a very easy way to toggle between development / production environments.