Re: [OSM-talk] Bridge relation on way going under?

2011-05-31 Thread M∡rtin Koppenhoefer
2011/5/29 Borbus bor...@gmail.com:
 I think a much more useful application than those suggested already is
 to identify all of the bridges that cross over a way.  It's easy to find
 all of the ways that go under a way, but what use is that?  It's quite
 important for waterways in general to be able to find every bridge that
 will be crossing over your path, and it's also necessary if routing for
 a tall vehicle on roads.


yes, but you only have to modify the above query posted by Lennard
slightly to get the ways that cross over the way instead of those
under the way. There is no need for a relation, and it would not even
help to have these relations (because only a subset will be mapped
with them, so you still would perform a database check if this
information was important to you).

cheers,
Martin

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Bridge relation on way going under?

2011-05-29 Thread Borbus
I think a much more useful application than those suggested already is
to identify all of the bridges that cross over a way.  It's easy to find
all of the ways that go under a way, but what use is that?  It's quite
important for waterways in general to be able to find every bridge that
will be crossing over your path, and it's also necessary if routing for
a tall vehicle on roads.

-- 
Borbus.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


[OSM-talk] Bridge relation on way going under?

2011-05-28 Thread Dave F.

Hi

This wiki page:

http://wiki.openstreetmap.org/wiki/Relations/Proposed/Bridges_and_Tunnels

talks about adding a relation to the way going under the bridge.

This statement:

allows both the way(s) crossing the structure /and/ those passing under 
it to be identified (river and most canals bridges only pass /over/ the 
waterway, and using only the Way tag bridge=yes means that intersection 
tests would have to be used to determine the bridges; now we can 
associate the bridges with the waterway as well.


is unclear (to me) as to why it's necessary. Why does an intersection 
test need to be performed; doesn't the 'bridge=' tag define that the two 
crossing ways are separate?


Hope you can clarify it for me.

Cheers
Dave F.


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Bridge relation on way going under?

2011-05-28 Thread Tobias Knerr
Dave F. wrote:
 http://wiki.openstreetmap.org/wiki/Relations/Proposed/Bridges_and_Tunnels
[...]
 This statement:
 
 allows both the way(s) crossing the structure /and/ those passing under
 it to be identified (river and most canals bridges only pass /over/ the
 waterway, and using only the Way tag bridge=yes means that intersection
 tests would have to be used to determine the bridges; now we can
 associate the bridges with the waterway as well.
 
 is unclear (to me) as to why it's necessary. Why does an intersection
 test need to be performed; doesn't the 'bridge=' tag define that the two
 crossing ways are separate?

Let's say my application needs to answer, for whatever reason[1], the
question what ways are below this bridge.

If there is no relation, then this is what the application would do:
* gather at all the ways around the bridge
* find ways that intersect the bridge way, ignoring the third dimension
* check the layer on these ways
- all ways that intersect the bridge way (in 2D representation!) and
have a lower layer are below the bridge.

With a relation, these calculations would not be necessary. In my
opinion, this is not a reason to use a bridge relation, though. (There
/are/ reasons for using a bridge relation, but this is not one of them.)

-- Tobias Knerr

[1] most programs don't even need to know that. Routers can rely on the
convention that there is no connection between ways without a common
node, and 2D renderers only need the layer. A group of applications
which actually need that information are advanced 3D renderers.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Bridge relation on way going under?

2011-05-28 Thread Lennard

On 28-5-2011 18:46, Tobias Knerr wrote:


With a relation, these calculations would not be necessary.


The people that come up with these types of relations seem to forget 
that spatial data is what OSM is all about.



For instance, using the osm2pgsql schema:

http://www.openstreetmap.org/browse/way/13884500

Which roads/railways/waterways does this bridge cross?

select osm_id,highway,railway,waterway,name
 from (
  select l1.osm_id,l1.highway,l1.railway,l1.waterway,l1.name,
case when l1.layer ~ E'^-?[[:digit:]]+(\.[[:digit:]]+)?$'
then cast (l1.layer as float) else 0 end as crossing_layer,
case when l2.layer ~ E'^-?[[:digit:]]+(\.[[:digit:]]+)?$'
then cast (l2.layer as float) else 0 end as bridge_layer
from planet_osm_line l1, planet_osm_line l2
where ST_Crosses(l2.way, l1.way)
  and l2.osm_id = 13884500
  and (l1.highway is not null or l1.waterway is not null
   or l1.railway is not null)
 ) as foo
 where crossing_layer  bridge_layer;


  osm_id   |   highway| railway | waterway |   name
---+--+-+--+--
  41050723 |  | rail|  |
  98667698 |  | rail|  |
  25933220 | unclassified | |  | Ferdinand Perdieusstraat
  71890307 | path | |  | Brampad
   9923332 |  | rail|  | Lijn 36
 107068083 | residential  | |  | Brandweg
  53085949 | cycleway | |  |
  25806811 | path | |  | Tunnelstraat
  22903417 | unclassified | |  | Brandenstraat
(9 rows)

Time: 7.328 ms


--
Lennard

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk