[OSM-talk] need advice for clever query or script

Imre Samu pella.samu at gmail.com
Fri Aug 29 12:22:10 UTC 2014


Hi Richard,

> clever query or script

maybe you can use OSM OPL format this ad-hoc query,
and process the data  with sed, awk, grep .

my draft ubuntu script - with comments.

https://gist.github.com/ImreSamu/be49fd1ce511975325d2#file-bridge_swing-sh

result (  Overpass-Wizard Query - but you can export the data to JOSM   )

https://gist.github.com/ImreSamu/a2dd0a8c25f0fea5284c#file-bridge_swing_overpass_wizard-md


the example result - Overpass-Wizard Query :

type:way and ( id:28134411 or id:29295367 or id:30178341 or id:30178382 or
id:33132931 or id:33132936 or id:33132949 ) global


( http://wiki.openstreetmap.org/wiki/Overpass_turbo/Wizard -> see
"Meta-Data Filters" )

*How to check the query *

** go  http://overpass-turbo.eu/ <http://overpass-turbo.eu/> *
** select "Wizard"*
* * copy /paste the generated query :  " type:way and ( id:27001207 or
id:72584563 )  global"*
* * "Build and run query" -> and check the result.*
* * if you got timeout error, then check the generated script timeout (
"<osm-script output="json" timeout="25">" )  and set to 200 - and rerun  *
** you can "load data into an OSM editor: JOSM,"  - see "Export" menu *




>From the OSM OPL history  - very easy to grep the first contributor

# convert the osm history file to OPL ( *osmium cat w11323607.osh  -f opl*  )
# sample OSM History OPL file:
#  w100646626 v1 dV c7343540 t2011-02-20T15:08:57Z i37137
uDerick%0020Rethans Tbridge=yes,highway=footway
Nn309461645,n1163494643
#  w100646626 v2 dV c12447614 t2012-07-23T09:52:38Z i404175 urickogden
Tbridge=swing,highway=footway Nn309461645,n1163494643
#  w100646626 v3 dV c18538313 t2013-10-25T16:16:57Z i24119 uMauls
Tbridge=swing,highway=footway Nn309461645,n2508499967
#  w100646626 v4 dV c25024407 t2014-08-26T10:51:45Z i66391 ugeozeisig
Tbridge=movable,bridge:movable=swing,highway=footway
Nn309461645,n2508499967
#  w100646626 v5 dV c25050883 t2014-08-27T12:42:02Z i66391 ugeozeisig
Tbridge=swing,highway=footway Nn309461645,n2508499967
#
# filter the results by the first contributor who added bridge=swing to the way
#     ( *egrep -m 1 '( T|,)bridge=swing'* )
#result: v2
#  w100646626 v2 dV c12447614 t2012-07-23T09:52:38Z i404175 urickogden
Tbridge=swing,highway=footway Nn309461645,n1163494643
#


The OPL format - from the OSMIUM manual:

v - Version

d - Deleted flag ('V' - visible or 'D' - deleted)

c - Changeset ID

t - Timestamp (ISO Format)

i - User ID

u - Username

T - Tags

x - Longitude (nodes only)

y - Latitude (nodes only)

N - Nodes (ways only)

M - Members (relations only)


you can find other interesting examples in the OSMIUM manual

"Find all users who have created post boxes:"

egrep ' v1 ' data.osm.opl | egrep 'amenity=post_box' | cut -d' ' -f7 |
cut -c2- | sort -u


OSMIUM tool - and more examples :

http://osmcode.org/libosmium/manual/libosmium-manual.html#output-formats
https://www.sotm-eu.org/en/slots/36
https://www.sotm-eu.org/slides/44.pdf



Imre



2014-08-28 12:39 GMT+02:00 Richard Z. <ricoz.osm at gmail.com>:

> Hi,
>
> trying to clean up bridge=swing as far as possible. There was at least
> user in the past who used the combination systematically wrong, so I want
> to split the result by user who introduced the bridge=swing.
>
> To make things complicated - a few days ago one contributor did a well
> meant effort to convert all
>   bridge=swing -> bridge=movable+bridge:movable=swing
> and reverted that edit because there were too many errors in it. Hence
> doing a naive search for user doesn't work.
>
> So I want to :
>  * find all bridge=swing
>  * split results by the first contributor who added bridge=swing
>    to the way
>  * get the results into JOSM for examination and editing
>
> Tia for any hints,
> Richard
>
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20140829/7d8e19a8/attachment.html>


More information about the talk mailing list