Re: [OSM-dev] Multipolygon decoding

2016-01-03 Thread Paul Norman

On 1/3/2016 2:24 PM, Mikoláš Štrajt wrote:
I am developing my own rendering software and I struggled on decoding 
multipolygon relations. It seems to be bit tricky. I tried to found 
some info about it, but all I found is this wiki page: 
http://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm


Can you point to some example of code decoding multipolygons? I would 
especially like something that will be written with renderer in mind 
(ie source code is part of some renderer).


Note that my software decodes OSM XML file itself, I don't want to use 
PostGIS as backend.


libosmium, osm2pgsql, and imposm all have implementations of converting 
multipolygon relations to geometries.


I would recommend using libosmium in your software if at all possible, 
rather than trying to decode OSM PBFs and XML yourself.


___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


[OSM-dev] Multipolygon decoding

2016-01-03 Thread Mikoláš Štrajt
Hello,
I am developing my own rendering software and I struggled on decoding 
multipolygon relations. It seems to be bit tricky. I tried to found some 
info about it, but all I found is this wiki page: http://wiki.openstreetmap.
org/wiki/Relation:multipolygon/Algorithm

Can you point to some example of code decoding multipolygons? I would 
especially like something that will be written with renderer in mind (ie 
source code is part of some renderer).

Note that my software decodes OSM XML file itself, I don't want to use 
PostGIS as backend.

-- 
Mikoláš Štrajt 
___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Multipolygon decoding

2016-01-03 Thread Michael Zangl
Hello,

Josm renders them and only uses it's own Java objects after reading the
XML. There are two rendering phases: Collecting the styles to be
rendered and then painting everything on the screen.

Here are some hints on where to get started:

The generation of styles for a multipolygon is triggered here:
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L367

Style collection (finding what needs to be drawn):
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java#L1837

We inherit the style of the surrounding ways from the multipolygon. That
way, multipolygon borders can be rendered like normal ways.
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L203

Old (deprecated) polygons inherit their style from the outer lines:
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java#L301

And finally the real rendering of the area (borders are rendered since
their line segments got the style from the multipolygon).
> https://github.com/openstreetmap/josm/blob/7a780ca01e8b2b31fbfa243af1db37d032ba7853/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java#L615

Michael


Am 03.01.2016 um 23:24 schrieb Mikoláš Štrajt:
> Hello,
> I am developing my own rendering software and I struggled on decoding 
> multipolygon relations. It seems to be bit tricky. I tried to found some 
> info about it, but all I found is this wiki page: http://wiki.openstreetmap.
> org/wiki/Relation:multipolygon/Algorithm
> 
> Can you point to some example of code decoding multipolygons? I would 
> especially like something that will be written with renderer in mind (ie 
> source code is part of some renderer).
> 
> Note that my software decodes OSM XML file itself, I don't want to use 
> PostGIS as backend.
> 
> 
> 
> ___
> dev mailing list
> dev@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
> 


___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev