From OpenStreetMap Wiki
Jump to: navigation, search

New tasks for Osmosis

Tile Cutter task

Crop input OSM data to a given tile/bounding box. Different methods to process ways against a tiling box:

  • Non-routable ways: insert synthetic nodes at tile border, discard nodes outside border. Split into multiple ways if multiple sections are inside and outside tile border.
  • Routable ways: Break ways at routing nodes. North and East edges keep all way nodes outside the border up to the next routing node. South and West edges discard all way nodes outside the border and all nodes from the border to the nearest routing node (to prevent overlap with neighboring tiles). Split into multiple ways if multiple sections are inside and outside the tile border.
  • Polygons: Insert synthetic nodes at tile border and at tile corners if needed, discard nodes outside border. Consider multipolygon relations for holes, which might turn a polygon-with-hole into a simple polygon if both the outer and inner polygon are cut by the tile border. Also consider special case where the outer border of a polygon may lie completely outside the tile border.
  • Coastlines/synthetic polygons: Create polygons from (potentially multiple) non-closed linestrings based on a "water/polygon area on the right" rule. Extend polygon to tile borders using synthetic nodes and consider islands to create a hole in the ocean polygon. Special consideration for the case where an island is by itself in the middle of a tile, with no segments intersecting the tile border, and no other similarly-tagged ways in the tile.

These different methods will be invoked by classifying the input ways into categories using the #Match package with rules defined by an XML file in this proposed format.

Tag Filter task

Pass nodes and ways to tester to match against tests defined in a rules file. Only pass through nodes which pass test or are a member of ways which pass test. Pass through ways which pass test. Pass through relations which either pass their own test or have member nodes or ways which passed the test.

Possible implementation: First, store all nodes. Next, apply tests to ways and store matching ones. Then evaluate nodes and pass through nodes which result in a true test result or are members of ways which tested true. Then pass through the stored ways and relations which test true or have members which tested true. Consider completeRelations for nested relations and also whether the relation should be mangled to remove missing members.

Transform task

(potentially for a number of applications but initially for routable Garmin GPS maps) Takes in raw OSM ways, nodes and relations (collectively, entities) and transforms them into a form usable by specific applications. Specifically, test each entity against a set of rules and on a true test result, take action based on the rules. Part of the action includes creating attributes either derived from tag values or with a constant value based on test matches. The output of this may just be OSM entities with added (or replaced?) tags containing the attribute values.

Utility packages

Match package

Provides a way to evaluate an entity against a set of rules and return a result of the match test. Tests should have access to the full data set to evaluate more than just the element currently under consideration. If inspecting a relation, may want to get information on its members. Or for a way, the tags or location of its member nodes may be important.