Discussion:
[Marble-devel] Marble with offline OSM maps
Jeremie Scheer
2012-05-15 10:01:29 UTC
Permalink
Hi,

I'd like to use Marble as a Qt Widget on an embedded system that runs
with an ARM processor.

So, as my system isn't connected to the Internet, I must be able to
directly use OSM vector files in Marble to display maps.

Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?

Thanks,
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com
Torsten Rahn
2012-05-15 10:29:32 UTC
Permalink
Hi,
Post by Jeremie Scheer
I'd like to use Marble as a Qt Widget on an embedded system that runs
with an ARM processor.
You might want to default to Mercator projection in Marble since that delivers
the best speed. This might especially be relevant on embedded systems and ARM
devices.
Post by Jeremie Scheer
So, as my system isn't connected to the Internet, I must be able to
directly use OSM vector files in Marble to display maps.
It's trivially easy to preload the tiled bitmaps and it's also easy to preload
the routing/search info.

Vector rendering and vector data however is still considered to be at an
experimental stage:

Have a look at



to see it in action. Or see

Loading Image...

bitmap version on the top, vector version of the same map on the bottom for
comparison.

As you can see there are still a few things missing (road labels, etc.) but we
gladly accept patches ;)

Note that Marble currently only support import of single files. So there is no
"tile management" as it exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?
Have a look at

http://techbase.kde.org/Projects/Marble/MarbleCPlusPlus

and the pages that follow.

Looking at the source code it looks like

myMarbleWidget->model()->addGeoDataFile("/home/thatsme/marbletown.osm")

should do the trick.

Speed depends on the file size, so smaller files generally result in better
performance.

BR,
Torsten
Post by Jeremie Scheer
Thanks,
Dennis Nienhüser
2012-05-15 11:36:33 UTC
Permalink
Post by Torsten Rahn
As you can see there are still a few things missing (road labels,
etc.) but we gladly accept patches ;) Note that Marble currently only
support import of single files. So there is no "tile management" as it
exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?
It's also useful to know that there's a GSOC project this year by Ander
that will further improve our OSM vector rendering towards making it
end-user ready.

Regards,
Dennis
Jeremie Scheer
2012-05-15 12:29:15 UTC
Permalink
Thanks for your answers.

I'm a beginner with map and geolocalization tools, so there are many
things I still don't know.
Post by Torsten Rahn
You might want to default to Mercator projection in Marble since that delivers
the best speed.
How can you do that ? Is there a method in the code to default to Mercator ?
Post by Torsten Rahn
It's trivially easy to preload the tiled bitmaps
Where can you find tiled bitmaps from OSM on the Internet ? Or OSM files
must be transformed to tiled bitmaps with Mapnik first ?


Now if I have tiled bitmaps, how can I use them in Marble library being
offline ?

Regards,
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com
Post by Torsten Rahn
Post by Torsten Rahn
As you can see there are still a few things missing (road labels,
etc.) but we gladly accept patches ;) Note that Marble currently only
support import of single files. So there is no "tile management" as
it exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?
It's also useful to know that there's a GSOC project this year by
Ander that will further improve our OSM vector rendering towards
making it end-user ready.
Regards,
Dennis
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
Dennis Nienhüser
2012-05-15 12:41:33 UTC
Permalink
Hi Jeremie,
Post by Jeremie Scheer
Thanks for your answers.
I'm a beginner with map and geolocalization tools, so there are many
things I still don't know.
Post by Torsten Rahn
You might want to default to Mercator projection in Marble since that delivers
the best speed.
How can you do that ? Is there a method in the code to default to Mercator ?
Yes, MarbleWidget::setProjection(); See [1] for a code example.
Post by Jeremie Scheer
Post by Torsten Rahn
It's trivially easy to preload the tiled bitmaps
Where can you find tiled bitmaps from OSM on the Internet ? Or OSM
files must be transformed to tiled bitmaps with Mapnik first ?
Now if I have tiled bitmaps, how can I use them in Marble library
being offline ?
Regards,
The easiest way is to open Marble as a regular program, select the map
theme you'd like to use (possibly OpenStreetMap) and use File->Download
Region to have Marble retrieve the bitmaps for you. They'll end up in
(for OpenStreetMap) the ~/.local/share/marble/maps/earth/openstreetmap/
directory.
You can transfer the contents of the directory to your device and
they'll be automatically found and used by Marble and also applications
using Marble as a library (assuming you transfer it to the right
directory on the device). The directory must not be user specific, you
can also use Marble's system directory (where openstreetmap.dgml gets
installed to).

Note however that this approach scales well performance wise, but does
not scale storage wise to provide map data for the entire planet in
street zoom level (unless you have several GB available).

Regards,
Dennis

[1] http://techbase.kde.org/Projects/Marble/MarbleMarbleWidget
Dennis Nienhüser
2012-05-15 13:50:17 UTC
Permalink
Hi Jeremie,
Post by Jeremie Scheer
Ok I will try with OSM raw files first to see if it corresponds to my
needs.
Post by Dennis Nienhüser
You can transfer the contents of the directory to your device and
they'll be automatically found and used by Marble and also
applications using Marble as a library (assuming you transfer it to
the right directory on the device). The directory must not be user
specific, you can also use Marble's system directory (where
openstreetmap.dgml gets installed to).
The map installation directory can be in another path than Marble's
system directory ? My maps will be installed on a SD card that will be
inserted in the system, so how can I set the map directory to another
location in the application code ?
you've got several options to accomplish that:

(1) Use MarbleDirs::setMarbleDataPath() to have the system path point to
some directory on the sd card (fill content as needed)
(2) Use the XDG_DATA_HOME environment variable to change the user path
to point to the sd card
(3) Change openstreetmap.dgml to use an absolute path (on the sdcard) in
the <sourcedir> fields

On Nokia mobile phones for example we use a combination of (2) and (3)
such that all user retrieved (cached) data is downloaded to the largest
partition on the device (2) and share openstreetmap data with other
applications (3). I decided against using (1) there to prevent that
users mess with data they should not mess with (i.e. users can safely
wipe out the entire marble cache folder and still all map themes are
there because they are in the system path).

Regards,
Dennis
Jeremie Scheer
2012-05-15 14:23:22 UTC
Permalink
I will certainly use the first option, that seems the most secure and easy.

Thank you very much for your answers and explanations, both of you. I
think I know enough now to begin some little tests with Marble.

Best regards,
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com
Post by Dennis Nienhüser
Hi Jeremie,
Post by Jeremie Scheer
Ok I will try with OSM raw files first to see if it corresponds to my
needs.
Post by Dennis Nienhüser
You can transfer the contents of the directory to your device and
they'll be automatically found and used by Marble and also
applications using Marble as a library (assuming you transfer it to
the right directory on the device). The directory must not be user
specific, you can also use Marble's system directory (where
openstreetmap.dgml gets installed to).
The map installation directory can be in another path than Marble's
system directory ? My maps will be installed on a SD card that will
be inserted in the system, so how can I set the map directory to
another location in the application code ?
(1) Use MarbleDirs::setMarbleDataPath() to have the system path point
to some directory on the sd card (fill content as needed)
(2) Use the XDG_DATA_HOME environment variable to change the user path
to point to the sd card
(3) Change openstreetmap.dgml to use an absolute path (on the sdcard)
in the <sourcedir> fields
On Nokia mobile phones for example we use a combination of (2) and (3)
such that all user retrieved (cached) data is downloaded to the
largest partition on the device (2) and share openstreetmap data with
other applications (3). I decided against using (1) there to prevent
that users mess with data they should not mess with (i.e. users can
safely wipe out the entire marble cache folder and still all map
themes are there because they are in the system path).
Regards,
Dennis
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com
Torsten Rahn
2012-05-15 12:58:15 UTC
Permalink
Hi Jeremie,
Post by Jeremie Scheer
Post by Torsten Rahn
You might want to default to Mercator projection in Marble since that
delivers the best speed.
How can you do that ? Is there a method in the code to default to Mercator ?
See part 2 of the Tutorial I referenced in my previous mail:

http://techbase.kde.org/Projects/Marble/MarbleMarbleWidget

As you can see there is a line

mapWidget->setProjection( Mercator );

which does this exactly.
Post by Jeremie Scheer
Post by Torsten Rahn
It's trivially easy to preload the tiled bitmaps
Where can you find tiled bitmaps from OSM on the Internet ? Or OSM files
must be transformed to tiled bitmaps with Mapnik first ?
See the user documentation:

http://docs.kde.org/stable/en/kdeedu/marble/download-region.html

You can use the normal Marble client to download bitmap tile data right from
the OpenStreetMap servers.

Note that there are OSM server restrictions to the download of a single query
(Marble's UI will inform you about those).

Make sure that the hard disc cache is big enough so that Marble will not
automatically start to delete the data you are downloading. By default it
measures around 300 MB which you might want to increase depending on the
amount of data you want to keep:

http://docs.kde.org/stable/en/kdeedu/marble/configcacheproxy.html

The data for OSM will end up inside

~/.local/share/marble/maps/earth/openstreetmap

You can either copy it into the very same place on your target device - or -
you put it into the system wide place which might be e.g.:

/usr/local/share/marble/data/maps/earth/openstreetmap

(start Marble with "marble --debug-info" on the command line and look for the
first few lines of output which looks like this:
System Path: "/usr/local/share/apps/marble/data"
This will tell you the correct place for your system data where
"maps/earth/openstreetmap" needs to get created inside )

If you keep it in the home directory on the target device then you also need
to apply the cache limit settings on the MarbleWidget used on the device -
otherwise Marble will delete excessive data automatically. So putting it into
the System Path might be the better solution.

Of course the alternative would still be to create bitmap tiles via Mapnik on
demand on your own server. That would require some additional magic on your
own server however.
Post by Jeremie Scheer
Now if I have tiled bitmaps, how can I use them in Marble library being
offline ?
You can use it right away if it's placed in the correct location on your hard
disc. See above. :-)

Best Regards,

Torsten
Post by Jeremie Scheer
Regards,
Post by Torsten Rahn
Post by Torsten Rahn
As you can see there are still a few things missing (road labels,
etc.) but we gladly accept patches ;) Note that Marble currently only
support import of single files. So there is no "tile management" as
it exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?
It's also useful to know that there's a GSOC project this year by
Ander that will further improve our OSM vector rendering towards
making it end-user ready.
Regards,
Dennis
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
Jeremie Scheer
2012-05-15 13:31:27 UTC
Permalink
Ok I will try with OSM raw files first to see if it corresponds to my needs.
But as I can see and as you describe it, Marble seems very easy to use
to get pre-rendered bitmaps of particular regions of the world.
Post by Dennis Nienhüser
You can transfer the contents of the directory to your device and
they'll be automatically found and used by Marble and also
applications using Marble as a library (assuming you transfer it to
the right directory on the device). The directory must not be user
specific, you can also use Marble's system directory (where
openstreetmap.dgml gets installed to).
The map installation directory can be in another path than Marble's
system directory ? My maps will be installed on a SD card that will be
inserted in the system, so how can I set the map directory to another
location in the application code ?

Thank you,
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com


PS: Excuse me Dennis Nienhüser for the double mail
Post by Dennis Nienhüser
Hi Jeremie,
Post by Jeremie Scheer
Post by Torsten Rahn
You might want to default to Mercator projection in Marble since that
delivers the best speed.
How can you do that ? Is there a method in the code to default to Mercator ?
http://techbase.kde.org/Projects/Marble/MarbleMarbleWidget
As you can see there is a line
mapWidget->setProjection( Mercator );
which does this exactly.
Post by Jeremie Scheer
Post by Torsten Rahn
It's trivially easy to preload the tiled bitmaps
Where can you find tiled bitmaps from OSM on the Internet ? Or OSM files
must be transformed to tiled bitmaps with Mapnik first ?
http://docs.kde.org/stable/en/kdeedu/marble/download-region.html
You can use the normal Marble client to download bitmap tile data right from
the OpenStreetMap servers.
Note that there are OSM server restrictions to the download of a single query
(Marble's UI will inform you about those).
Make sure that the hard disc cache is big enough so that Marble will not
automatically start to delete the data you are downloading. By default it
measures around 300 MB which you might want to increase depending on the
http://docs.kde.org/stable/en/kdeedu/marble/configcacheproxy.html
The data for OSM will end up inside
~/.local/share/marble/maps/earth/openstreetmap
You can either copy it into the very same place on your target device - or -
/usr/local/share/marble/data/maps/earth/openstreetmap
(start Marble with "marble --debug-info" on the command line and look for the
System Path: "/usr/local/share/apps/marble/data"
This will tell you the correct place for your system data where
"maps/earth/openstreetmap" needs to get created inside )
If you keep it in the home directory on the target device then you also need
to apply the cache limit settings on the MarbleWidget used on the device -
otherwise Marble will delete excessive data automatically. So putting it into
the System Path might be the better solution.
Of course the alternative would still be to create bitmap tiles via Mapnik on
demand on your own server. That would require some additional magic on your
own server however.
Post by Jeremie Scheer
Now if I have tiled bitmaps, how can I use them in Marble library being
offline ?
You can use it right away if it's placed in the correct location on your hard
disc. See above. :-)
Best Regards,
Torsten
Post by Jeremie Scheer
Regards,
Post by Torsten Rahn
Post by Torsten Rahn
As you can see there are still a few things missing (road labels,
etc.) but we gladly accept patches ;) Note that Marble currently only
support import of single files. So there is no "tile management" as
it exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain me
the way it can be done (directly by code and not in Marble menus) ?
It's also useful to know that there's a GSOC project this year by
Ander that will further improve our OSM vector rendering towards
making it end-user ready.
Regards,
Dennis
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
--
Jérémie Scheer
Software Engineer
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
ARMadeus Systems - A new vision of the embedded world
http://www.armadeus.com
Torsten Rahn
2012-05-15 13:36:37 UTC
Permalink
Post by Jeremie Scheer
The map installation directory can be in another path than Marble's
system directory ? My maps will be installed on a SD card that will be
inserted in the system, so how can I set the map directory to another
location in the application code ?
Have a look at chapter 3 inside

http://edu.kde.org/marble/obtain.php

which tells you how to change the Marble Data Path at runtime or compiletime
as you wish. (The same is possible in a similar fashion for plugins. But
that's probably not relevant for your case.)

Best Regards,
Torsten
Post by Jeremie Scheer
Thank you,
Post by Dennis Nienhüser
Hi Jeremie,
Post by Jeremie Scheer
Post by Torsten Rahn
You might want to default to Mercator projection in Marble since that
delivers the best speed.
How can you do that ? Is there a method in the code to default to Mercator ?
http://techbase.kde.org/Projects/Marble/MarbleMarbleWidget
As you can see there is a line
mapWidget->setProjection( Mercator );
which does this exactly.
Post by Jeremie Scheer
Post by Torsten Rahn
It's trivially easy to preload the tiled bitmaps
Where can you find tiled bitmaps from OSM on the Internet ? Or OSM files
must be transformed to tiled bitmaps with Mapnik first ?
http://docs.kde.org/stable/en/kdeedu/marble/download-region.html
You can use the normal Marble client to download bitmap tile data right
from the OpenStreetMap servers.
Note that there are OSM server restrictions to the download of a single
query (Marble's UI will inform you about those).
Make sure that the hard disc cache is big enough so that Marble will not
automatically start to delete the data you are downloading. By default it
measures around 300 MB which you might want to increase depending on the
http://docs.kde.org/stable/en/kdeedu/marble/configcacheproxy.html
The data for OSM will end up inside
~/.local/share/marble/maps/earth/openstreetmap
You can either copy it into the very same place on your target device -
/usr/local/share/marble/data/maps/earth/openstreetmap
(start Marble with "marble --debug-info" on the command line and look for
System Path: "/usr/local/share/apps/marble/data"
This will tell you the correct place for your system data where
"maps/earth/openstreetmap" needs to get created inside )
If you keep it in the home directory on the target device then you also
need to apply the cache limit settings on the MarbleWidget used on the
device - otherwise Marble will delete excessive data automatically. So
putting it into the System Path might be the better solution.
Of course the alternative would still be to create bitmap tiles via
Mapnik on demand on your own server. That would require some additional
magic on your own server however.
Post by Jeremie Scheer
Now if I have tiled bitmaps, how can I use them in Marble library being
offline ?
You can use it right away if it's placed in the correct location on your
hard disc. See above. :-)
Best Regards,
Torsten
Post by Jeremie Scheer
Regards,
Post by Torsten Rahn
Post by Torsten Rahn
As you can see there are still a few things missing (road labels,
etc.) but we gladly accept patches ;) Note that Marble currently only
support import of single files. So there is no "tile management" as
it exists for the OSM bitmap map theme.
Post by Jeremie Scheer
Is it possible to do that with Marble ? And if so, could you explain
me the way it can be done (directly by code and not in Marble menus)
?
It's also useful to know that there's a GSOC project this year by
Ander that will further improve our OSM vector rendering towards
making it end-user ready.
Regards,
Dennis
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
_______________________________________________
Marble-devel mailing list
https://mail.kde.org/mailman/listinfo/marble-devel
Loading...