{"id":19010867,"url":"https://github.com/osmcode/osm-tags-transform","last_synced_at":"2026-04-24T11:30:17.834Z","repository":{"id":43182853,"uuid":"461157895","full_name":"osmcode/osm-tags-transform","owner":"osmcode","description":"Transform tags in OSM files using Lua code","archived":false,"fork":false,"pushed_at":"2023-08-06T12:33:29.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-01T21:26:36.616Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osmcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-19T10:29:37.000Z","updated_at":"2024-07-31T15:05:22.000Z","dependencies_parsed_at":"2022-08-31T15:02:12.826Z","dependency_job_id":null,"html_url":"https://github.com/osmcode/osm-tags-transform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmcode%2Fosm-tags-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmcode%2Fosm-tags-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmcode%2Fosm-tags-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osmcode%2Fosm-tags-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osmcode","download_url":"https://codeload.github.com/osmcode/osm-tags-transform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240039910,"owners_count":19738420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:12:44.182Z","updated_at":"2026-04-24T11:30:17.792Z","avatar_url":"https://github.com/osmcode.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# osm-tags-transform\n\nThis command line tool can transform the tags of OSM objects in the input file\naccording to rules defined in a Lua script and write them out again. Objects\ncan also be filtered.\n\nIt can be used, for instance, to canonicalize OSM tags, remove unwanted tags or\nobjects, or transliterate names.\n\n## Usage\n\nCall with `--help` to get usage information. Typical use:\n\n```\nosm-tags-transform -c some_config.lua input.osm.pbf -o output.osm.pbf\n```\n\n## Lua Config File\n\nThe Lua config file has to define three callback functions which are called\nfor each node, way, or relation, respectively. (But see below for handling of\nobjects without tags.)\n\n```\nfunction ott.process_node(object)\n    ...\nend\n\nfunction ott.process_way(object)\n    ...\nend\n\nfunction ott.process_relation(object)\n    ...\nend\n```\n\nThe `object` parameter of those functions has the field `id` with the OSM\nobject id and the field `tags`, a Lua table with all the tags.\n\nThe functions must return either `true` if the object should be copied to the\noutput \"as is\", `false` if the object should be dropped or a Lua table with the\ntags it should have.\n\nNote that osm-tags-transform will **not** preserve reference-completeness\nof the data. Nodes are dropped from the file even if they might be referenced\nfrom ways and, similarly, objects that might be relation members can still\nbe dropped. Use [`osmium getid -r`](https://docs.osmcode.org/osmium/latest/osmium-getid.html)\nto re-establish reference-completness afterwards if needed.\n\nNote that if there is no process function for this object type defined, the\nobject is dropped, i.e. its as if there is a process function that always\nreturns `false` (only it is more efficient).\n\n\n## Handling of untagged objects\n\nBy default objects that have no tags at all are not sent to the process\nfunctions but just copied to the output. This optimizes for the most common\nuse case where you are interested only in changing some tags and any object\nwith no tags doesn't need changing. But there are other modes which you\ncan choose with the `-u MODE` or --`untagged=MODE` option:\n\n* `drop` - Drop all untagged objects.\n* `copy` - Copy all untagged objects to the output. This is the default.\n* `process` - Send untagged objects to the `process_*()` functions.\n\n\n## Geometry Processing\n\nBy default there is no geometry processing: There are no node locations or way\ngeometries etc. available in Lua.\n\nBut in some cases you want to take the geometry into account when transforming\ntags, for instance to transliterate names based on the country they are in or\nto process `ref` tags for highway shields depening on the country. In this case\nyou can enable geometry processing with the `-g bbox` or `--geom-proc=bbox`\ncommand line option.\n\nIf geometry processing is enabled, the `object` parameter to the Lua callback\nfunction has a field `bbox` which contains the bounding box of the object\n(as an array of four fields [left, bottom, right, top]).\n\nNote the node locations and way bounding boxes need to be stored somewhere\nfor this to work which can need quite a lot of memory. The way bounding boxes\nare always stored in memory. You can use the `-i` or `--index-type` command\nline option to change the index type used for the node locations. Use the\n`-I` or `--show-index-types` option to see what index types are available.\nSee the [osmium-index-types manpage](https://docs.osmcode.org/osmium/latest/osmium-index-types.html)\nwhich applies for this as well and the [chapter on indexes](\nhttps://osmcode.org/osmium-concepts/#indexes) in the Osmium Concepts Manual\nfor some more information.\n\n## Prerequisites\n\nosm-tags-transform needs the following libraries:\n\n* [bzip2](http://www.bzip.org/)\n* [expat](https://libexpat.github.io/)\n* [libosmium](https://osmcode.org/libosmium)\n* [protozero](https://github.com/mapbox/protozero)\n* [zlib](https://www.zlib.net/)\n* [Lua](https://www.lua.org/), optionally Lua JIT\n\nOn Debian/Ubuntu you can install these (and cmake) with:\n\n```\napt install \\\n    make \\\n    g++ \\\n    cmake \\\n    libbz2-dev \\\n    libexpat1-dev \\\n    liblua5.3-dev \\\n    libosmium2-dev \\\n    libprotozero-dev \\\n    zlib1g-dev\n```\n\n## Compiling\n\nYou need a C++ compiler with C++14 support.\n\nCompile as usual with CMake with something like:\n\n```\nmkdir build\ncd build\ncmake ..\nmake\n```\n\nYou can set these options:\n\n* Set `BUILD_TESTS=ON` if you want to build the tests.\n* Set `WITH_LUAJIT=ON` if you want to build with LuaJIT support.\n\n## License\n\nCopyright (C) 2022  Jochen Topf (jochen@topf.org)\n\nThis program is available under the GNU GENERAL PUBLIC LICENSE Version 3.\nSee the file LICENSE.txt for the complete text of the license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmcode%2Fosm-tags-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosmcode%2Fosm-tags-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmcode%2Fosm-tags-transform/lists"}