Re: [OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-18 Thread Richard Fairhurst
Joseph Eisenberg wrote:
> Is anyone aware of a way to import dual-carriageway roads as
> a single linestring?

I do something like this to boil route relations containing dual
carriageways down into polylines:

insert into routes_split(geom) (
  select (st_dump(
st_linemerge(
  st_approximatemedialaxis(
st_simplifypreservetopology(
  st_multi(
st_buildarea(
  st_buffer( st_collect(r.way) ,50 )
)
  )
,20)
  )
)
  )
).geom from (select way from routes where osm_id in (#{ids})) r )

But it's not an all-purpose solution, just something that works at small
scales (where junctions are unlikely to be significant) and for route
reconstruction purposes. I doubt very much that this approach would work
with osm-carto's principle of no preprocessing.

Richard



--
Sent from: http://gis.19327.n8.nabble.com/Developer-Discussion-f5233107.html

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


Re: [OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-18 Thread Martin Koppenhoefer
You would also have to know how many ways there are, just looking for 2 is
not sufficient, because there could be 3, 4, 5, 6 or even more. Around here
I've a situation with 6 parallel carriageways:
https://www.openstreetmap.org/#map=19/41.86472/12.49702
some meters north of this spot, they are even 7 for a short length (or 8,
if you count the cycleway and 9 if you also count the parking aisle).

And you would have to decide when not to do it, for example Via Palos runs
for some time parallely but then makes a turn and passes under the bridge:
https://www.openstreetmap.org/way/257174994#map=17/41.86821/12.49583

And if there are ways that run along the "principal" highway for some time
at only one side, but then vanish, and you calculate the center for the
"synthesis", it will put corners or curves in your main way which actually
runs straight.

You will surely have to define a maximum distance threshold for this
unification, and you always will have edge cases around this threshold
which can cause inconsistency.

Depending on your purpose, you also may want to not unify parallel ways
when they run on different levels, e.g. one on a bridge or embankment (e.g.
along a retaining wall), or in a cutting.

As you probably know, the typical OSM solution for this is raster
rendering, because then the ways merge visually and "automatically" (as
their width is usually exagerated and layer ordering renders first the
casing then the fill).


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


Re: [OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-18 Thread Jochen Topf
Hi!

On Fri, Oct 18, 2019 at 11:29:04AM +0900, Joseph Eisenberg wrote:
> Is anyone aware of a way to import dual-carriageway roads as a single
> linestring?
> 
> There's a request at Openstreetmap-carto to render dual-carriageway
> roads differently at mid-zoom levels:
> https://github.com/gravitystorm/openstreetmap-carto/issues/3934
> 
> It doesn't appear that there are any tags in the database which hold
> this information. Ideally one would import a linestring midway between
> two highway ways, if they were tagged with the same highway class,
> name, and oneway=yes, but it could be difficult to get this right at
> locations where the two carriageways separate.
> 
> Has anyone implemented a rendering that handles dual-carriageway
> roads, or designed a way to import such ways into a (rendering)
> database as a single linestring midway between the two OSM ways?

I have experimented with this and never got far enough to make this
actually useful. It is incredibly difficult to find the center line
between two carriage ways. The problem is not the lines, but the
junctions. All the algorithms I have tried do the right thing in many
cases but totally jumble up some complex junctions. I think that with
some more effort it should be possible to do this for some cases, like
only showing motorways in low-zoom level maps. But aggregating the lines
for mid to high zoom levels in urban areas is really hard, especially
when you expect the generalized center lines to still connect to the
rest of the road network.

Jochen
-- 
Jochen Topf  joc...@remote.org  https://www.jochentopf.com/  +49-351-31778688

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


Re: [OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-18 Thread Michael Reichert
Hi Joseph,

Am 18.10.19 um 04:29 schrieb Joseph Eisenberg:
> Has anyone implemented a rendering that handles dual-carriageway
> roads, or designed a way to import such ways into a (rendering)
> database as a single linestring midway between the two OSM ways?

We had a student at Geofabrik working on a programme to conflate
multiple parallel line strings of roads and railways as part of his
diploma thesis.

Author: Arne Johanessen
Title: Algorithmen zur automatisierten Generalisierung durch
Zusammenfassung von Linienzügen in OpenStreetMap für konkrete Spezialfälle
(translated title: Algorithms for automatic generalisation by conflation
of linestrings in OpenStreetMap for specific special cases)
Year: 2018

Full text PDF (German) is available at
http://www.geofabrik.de/media/2018-03-02-johannessen-diplomarbeit-generalisierung.pdf

The source code is available at
https://github.com/johannessen/combiner
The software is licensed under BSD 3-clause license.

Best regards

Michael

-- 
Michael Reichert  www.geofabrik.de
Geofabrik GmbHHandelsregister: HRB Mannheim 703657
Amalienstr. 44Geschaeftsfuehrung: C. Karch, F. Ramm
76133 Karlsruhe   Tel: 0721-1803560-3
reich...@geofabrik.de Fax: 0721-1803560-9



signature.asc
Description: OpenPGP digital signature
___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-18 Thread Mateusz Konieczny



18 Oct 2019, 04:29 by joseph.eisenb...@gmail.com:

> Is anyone aware of a way to import dual-carriageway roads as a single
> linestring?
>
I tried searching for way/tool that would do this some time ago and failed.

> It doesn't appear that there are any tags in the database which hold
> this information.
>
As I needed very accurate data I started to use dual_carriageway=yes
in my city - and I remain the only person using this tag.
___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


[OSM-dev] Processing dual carriageway highways into one linestring?`

2019-10-17 Thread Joseph Eisenberg
Is anyone aware of a way to import dual-carriageway roads as a single
linestring?

There's a request at Openstreetmap-carto to render dual-carriageway
roads differently at mid-zoom levels:
https://github.com/gravitystorm/openstreetmap-carto/issues/3934

It doesn't appear that there are any tags in the database which hold
this information. Ideally one would import a linestring midway between
two highway ways, if they were tagged with the same highway class,
name, and oneway=yes, but it could be difficult to get this right at
locations where the two carriageways separate.

Has anyone implemented a rendering that handles dual-carriageway
roads, or designed a way to import such ways into a (rendering)
database as a single linestring midway between the two OSM ways?

- Joseph Eisenberg

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