User:Contrapunctus

From OpenStreetMap Wiki
Jump to navigation Jump to search
OSM Logo This user submits data to OpenStreetMap under the name
contrapunctus.
Debian-logo-notext.svg Contrapunctus uses a Debian-based computer.
OsmAnd icon Contrapunctus uses OsmAnd, mobile map viewing & navigation app.
Babel
en-4 This user speaks English at a near-native level.
Template:User hi
de-2 Dieser Benutzer hat fortgeschrittene Deutschkenntnisse.

PT

Disclaimer - I have only mapped buses in Delhi, India, and have very little experience

1. in mapping other forms of transport e.g. Metro, trains, or trams

2. with public transport in other countries.

After trying many times to make sense of Proposed_features/Refined_Public_Transport, here's what I think would be some nice simplifications to the PTv2 schema -

1. Deprecate stop positions

2. Platforms are where people wait and where PSVs stop (public_transport=platform + bus=yes/train=yes/etc + bench, shelter, tactile_paving etc. If there is no infrastructure, the last three tags make that abundantly clear.)

  • It goes without saying that these are all never on a track or road, and always beside it.
  • This is how PTv2 already functions, but it seems not everyone understands it correctly.

3. stop_area relations should be made when a single stop (on one side of the road) has >1 platforms (e.g. https://www.openstreetmap.org/#map=17/28.53813/77.23235 ). In route relations, stop_area relations should be used in lieu of the platforms. The name=* and any other tags with identical values should be moved from the platforms to the stop_area relation.

  • I don't know if routers can reliably group together such platforms into one stop area themselves - if they can, there is no need for a stop_area relation. It does reduce tag duplication, though.

Problems this doesn't (yet) solve

1. Railways and Metro trains. They have name=* on stations, not platforms (those have a ref=*). On trains, the platform is subject to change, so you want the station and not the platform to go in the route relation. Maybe add stations to railway route relations, instead of platforms?

  • It would also be helpful to allow stations in bus routes, because buses often terminate there and there is no definite platform for them, either.

Scripts for geo: URIs

I hope these are useful to whoever finds them :)

coord2geo

 1 #!/bin/bash
 2 
 3 # Tests
 4 # coord2geo "28.5484586, 77.2566089"
 5 # coord2geo "-24.09498, -48.36436"
 6 
 7 if [[ $# == 0 ]]; then
 8     read -t 1 coordinates
 9 else
10     coordinates="$1"
11 fi
12 
13 if [[ "$coordinates" == "" ]]; then
14     printf "Usage: coord2geo [COORDINATES]\n\n"
15     printf "Makes a geo: link from COORDINATES, where COORDINATES is
16 \"<latitude>, <longitude>\"\n\n"
17     printf "If COORDINATES is omitted, stdin is used instead.\n\n"
18 else
19     lat="$(echo $coordinates | sed -n "s|\(.*\),.*|\1|p")"
20     lon="$(echo $coordinates | sed -n "s|.*, \(.*\)|\1|p")"
21     # printf "lat - $lat\nlon - $lon\n"
22     printf "geo:$lat,$lon\n"
23 fi

geo2osm

 1 #!/bin/bash
 2 
 3 # Test
 4 # geo2osm "geo:-24.09498,-48.36436?z=19"
 5 
 6 if [[ $# == 0 ]]; then
 7     read -t 1 link
 8 else
 9     link="$1"
10 fi
11 
12 if [[ "$link" == "" ]]; then
13     printf "Usage: geo2osm [GEO]\n\n"
14     printf "Makes an osm.org link from GEO, where GEO is a geo:
15 URI.\n\n"
16     printf "If GEO is omitted, stdin is used instead.\n\n"
17 else
18     lat="$(echo "$link" | sed -En "s|geo:([0-9\.-]*),.*|\1|p")"
19     lon="$(echo "$link" | sed -En "s|geo:.*,([0-9\.-]*).*|\1|p")"
20     zoom="$(echo "$link" | sed -En "s|.*\?z=([0-9]*)|\1|p")"
21 
22     # test printf -
23     # printf "lat $lat\nlon $lon\nzoom $zoom\n"
24 
25     if [[ "$zoom" == "" ]]; then
26         # doesn't need a zoom value, adds a nice pointer
27         printf "https://www.openstreetmap.org/?mlat=$lat&mlon=$lon\n"
28     else
29         printf "https://openstreetmap.org/#map=$zoom/$lat/$lon/\n"
30     fi
31 fi

geo2osm-browse

1  #!/bin/bash
2 
3  if [[ $# == 0 ]]; then
4      read -t 1 link
5  else
6      link="$1"
7  fi
8  xdg-open "$(geo2osm $link)"

Having geo: URIs open on osm.org in your browser

Save the geo2osm and geo2osm-browse scripts in files of the same name in ~/bin/

Make them executable.

cd ~/bin/
chmod u+x geo2osm geo2osm-browse

Open ~/.local/share/applications/mimeapps.list in a text editor and add the following line.

x-scheme-handler/geo=geo.desktop

In the same directory, create a file called geo.desktop containing the following.

[Desktop Entry]
Version=1.0
Type=Application
Exec=/home/YOUR-USERNAME-HERE/bin/geo2osm-browse %u
Icon=geo2osm-browse
StartupNotify=true
Terminal=false
Categories=Utility;
MimeType=x-scheme-handler/geo
Name=Geo: Launcher
Comment=Open geo: links on osm.org

Voila! xdg-open should now open geo: URIs on osm.org in your preferred browser! :D