[QGIS-Developer] OsmAnd obf data + styling ?

Stefan Keller sfkeller at gmail.com
Mon Oct 16 14:20:26 PDT 2017


Hi,

2017-10-16 10:22 GMT+02:00 PIERRE Sylvain <sylvain.pierre at bas-rhin.fr>:
> I'm interest in OSMAND rendering too.
> XML ressources for styling are here :
> https://github.com/osmandapp/OsmAnd-resources/tree/master/rendering_styles
>
> Question is: how can I apply one OSMAND style to OSM data?

Let me explain it like this: Every style (e.g. OsmAnd default style)
is written in a style language, which maps a data object (e.g. an OSM
tree) to a symbol (e.g. pine.svg), perhaps with a data filter, like
filtering only OSM trees with tag "pine" and given a certain scale
range.
OsmAnd has a fixed OsmAnd specific data schema (derived from OSM
data), an OsmAnd specific styling language, an OsmAnd specific default
style written in this language (in XML) and an OsmAnd specific Java
renderer.
Given QGIS would be able to read the fixed OsmAnd specific data schema
and format, we still face the problem that there is no software which
would translate an OsmAnd style to QGIS styles (remember: the only
existing software is the OsmAnd app which interprets OsmAnd styles).
And even if we would have such a OsmAnd style interpreter, we always
would be dependent of OsmAnd tools and every time we want to include
another OSM object (say a bench) ,we would have to convince OsmAnd
devs that this also belongs into OsmAnd.

That's why I suggest another approach: Let's use the new 2D vector
tiles technology with the de-facto standard specified by Mapbox. This
mainly consists of the MVT spec. plus metadata. There is even a file
format - mbtiles for vector tiles, which is not yet a standard (there
are GeoPackage Extensions under way) but it's already usable for
offline use, e.g. in the Vector Tiles Reader plugin.

There exist free vector tiles services e.g. from OpenMapTiles.org and
MapZen (both with different data schematas) and downloadable (mbtiles)
data e.g. from OpenMapTiles.org. And there exist even vector tiles
generators, like tilemaker or t-rex to produce vector tiles (mbtiles
format) on your own.

What still remains to be resolved is the question of nice open base map styles:

2017-10-16 8:44 GMT+02:00 Richard Duivenvoorde <rdmailings at duif.net>:
> ...
> My aims is just to make it easier to have for example a local reference
> map for offline users. The ability to do routing on it was also a nice
> feature of their format...
>
> Are you aware of a nice (QGIS) styling for that data model then?
> (lines, multipolygons, planet_osm_lines/_points/_polygons, points)

What you cite here as data model/schema is the "osm2pgsql schema"
which is typically used together with mapnik styles (XML/CartoCSS) and
renderer.
Given this data schema you could use also the QGIS styling language
and there is at least one nice QGIS style I'm aware of:
https://github.com/yannos/beautiful_osm_in_qgis/
This is a nice starting point - but it will inevitably become slow for
larger areas since planet osm_points is a huge table which needs to be
fully scanned several times for every zoom/pan.

Now coming back to my vector tiles approach: The Vector Tiles Reader
plugin comes with a simple base map style made for OpenMapTiles
(service or offline mbtiles):
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/tree/master/styles
. These .QML files need some love and everyone is invited to enhance
this style and submit pull requests to this repo.

Looking at OpenMapTiles.org you'll see many nice base map styles with
an open license. These styles are written in the MapBox GL JS styling
language which is something QGIS can not read. So my plans with the
Vector Tiles Reader plugin are to get e.g. a converter which
translates them to MapBox GL JS => QGIS QML. But don't expect too much
from such a software since I'd dare to say that no style language
(QML, SLD/SE, MapServer, MapBox GL JS, OsmAnd, Mapnik XML/CartoCSS,
ArcGIS) can be converted to another without information loss.

So good thing is, that there's already a basic reference map style
available in the Vector Tiles Reader (QML as mentioned above) which
can be tested and enhanced already now.

:Stefan


P.S. The OSM export sites I gave you (HOT Export and OSMaxx) have
different data schematas and I'm only aware of an OSMaxx default style
which fits to the OSMaxx schema - but it's not yet a really "nice
style" nor is it as nifty like vector tiles. They are rather OSM data
for thematic maps or spatial analysis.


2017-10-16 10:22 GMT+02:00 PIERRE Sylvain <sylvain.pierre at bas-rhin.fr>:
> I'm interest in OSMAND rendering too.
> XML ressources for styling are here :
> https://github.com/osmandapp/OsmAnd-resources/tree/master/rendering_styles
>
> Question is: how can I apply one OSMAND style to OSM data?
>
> Sylvain
>
> -----Message d'origine-----
> De : QGIS-Developer [mailto:qgis-developer-bounces at lists.osgeo.org] De la part de Stefan Keller
> Envoyé : dimanche 15 octobre 2017 00:19
> À : qgis-developer
> Cc : richard at duif.net
> Objet : Re: [QGIS-Developer] OsmAnd obf data + styling ?
>
> 2017-10-14 23:44 GMT+02:00 Stefan Keller <sfkeller at gmail.com>:
>> It's using OSM data, so why not taking the data directly from OSM e.g.
>> using HOT Export [2] or OSMaxx tools [3]?
> ...
>> [1] http://osmand.net/help/MapAddressDataStructure.html
>> [2] https://export.hotosm.org/
>> [3] https://osmaxx.hsr.ch/
>
> ... and for base maps I hope the Vector Tiles Reader [4] plugin becomes better and better...
>
> :Stefan
>
> [4] http://plugins.qgis.org/plugins/vector_tiles_reader/
>
> 2017-10-14 23:44 GMT+02:00 Stefan Keller <sfkeller at gmail.com>:
>> 2017-10-14 16:51 GMT+02:00 Richard Duivenvoorde <rdmailings at duif.net>:
>>> As OsmAnd (for Android and Iphone) [0][1] is getting better and
>>> better, I wonder if we/QGIS can (re)use/handle their data source and styling.
>>
>> According to [1] the 'obf' file has a complex structure and consists
>> of 4 multiple parts:
>> (vector) map tiles, transport (routing), POI, adresses.
>> The OsmAnd styling seems to come with the Java binaries.
>>
>> What is your use case to read such a specialized format into QGIS?
>>
>> It's using OSM data, so why not taking the data directly from OSM e.g.
>> using HOT Export [2] or OSMaxx tools [3]?
>>
>> :Stefan
>>
>> [1] http://osmand.net/help/MapAddressDataStructure.html
>> [2] https://export.hotosm.org/
>> [3] https://osmaxx.hsr.ch/
>>
>>
>> 2017-10-14 16:51 GMT+02:00 Richard Duivenvoorde <rdmailings at duif.net>:
>>> As OsmAnd (for Android and Iphone) [0][1] is getting better and
>>> better, I wonder if we/QGIS can (re)use/handle their data source and styling.
>>>
>>> The format is a binary .obf file in (protobuf apparently? [2])?
>>> Is this some kind of vector tiling?
>>>
>>> Anybody interested, or has some more info about this?
>>>
>>> Regards,
>>>
>>> Richard Duivenvoorde
>>>
>>>
>>> [0] http://osmand.net/
>>> [1] https://github.com/osmandapp/Osmand
>>> [2]
>>> https://github.com/osmandapp/OsmAnd-tools/tree/master/OsmAndMapCreato
>>> r _______________________________________________
>>> QGIS-Developer mailing list
>>> QGIS-Developer at lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list