[OSM-talk] osm-filter.pl observations

Andrew Loughhead andrew at incanberra.com.au
Wed Aug 9 14:15:05 BST 2006


Joerg, I have made some study of osm-filter.pl. I have comments about 
the straight line filter (reduce_filter), allow and deny waypoints, and 
using osm.txt.

Overall I think the effect of the osm-filter.pl script is great. Once I 
figured out how to use it the results are impressive, in terms of 
eliminating certain types of error and removing redundant points from my 
track data.


Straight line filtering (--use_reduce_filter)
*********************************************

osm-filter.pl -h and -man do not mention --use_reduce_filter.  For 
several days I thought the only way to get straight line filtering was 
--filter-all, until I found this in the source.  Once found I was very 
happy with the straight line filtering.

One usage error I initially made was in filtering data I collected on a 
dual carriageway. I had two gpx files, one for each direction. If I ran 
both files into osm-filter.pl at once, it thinks there is only one road. 
If I run the files separately I get two very nice well simplified roads, 
as needed, although they do not get the adjacent nodes as suggested in 
the OSM style guide.


Waypoints (--limit-area)
************************

osm-filter.pl -h and -man say filter.deny and filter.allo are the terms 
to use in ways.txt, but the code (line 1212) seems to use filter.allow.

I have defined two filter waypoints in ~/.gpsdrive/way.txt.  When file 
00_filter_areas.gpx is generated, the filter.allow circle has a halo of 
points every 10 degrees, on the outside. The filter.deny circle has a 
halo of points every 10 degrees, on the inside. Are those halo's 
intentional?

I find that a waypoint deny filter only works if I also have an 
encompassing waypoint allow filter, as a way.txt entry.  Basically in 
order to deny, it seems I first must explicitly allow.  So I have an 
allow filter with a 50000 radius, and a deny filter with a 1000 metre 
radius embedded within the allow filter. Am I missing something?

As a separate issue, if I uncomment the "World" allow block, in 
areas_allowed_squares, this seems to override the waypoint filters 
entirely and my waypoint deny filter no longer operates.

Can I suggest that osm-filter.pl --filter-all not just exit in the case 
that osm.txt is not found, but instead writes out the option list that 
is next best, such as --split-tracks --filter_duplicate_tracepoints 
--use_reduce_filter --limit-area. Is there a reason that --filter-all 
does not include --limit-area?


osm.txt (--check_against_osm)
*****************************

I found it fairly straightforward to download just my area with JOSM, 
and then convert that to osm.txt, as you described.  I did not use the 
create.sh method, as this other method makes it possible to keep my own 
osm.txt up to date, after I commit my edits. The steps I used are:

  - In JOSM get an appropriate area in view. Define a JOSM bookmark.
  - Remove all current layers.
  - Download from Server ("raw gps data" unchecked), using the bookmark.
  - Click Save.
  - Change to Files of Type: OSM Server Files.
  - Type an appropriate name (say, local.osm).
  - Create a subdirectory called Data, to the directory where your .osm 
file is.
  - In a shell run something like:
    svn.openstreetmap.org/utils/osm-pdf-atlas/planet_osm2txt.pl local.osm
  - In the Data subdirectory find the file osm.txt.
  - Copy osm.txt to one of the locations specified in osm-filter.pl -h, 
such as ~/.gpsdrive/MIRRORS/osm/osm.txt

Having got all that set up, --filter-all became usable. The filtering 
against existing segments seems good too.

cheers
Andrew.





More information about the talk mailing list