NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I have some external data which I've converted into .osm format, resulting in the following:

          <tag k="Mode" v="highway" />
          <tag k="Type" v="primary" />

which I'd like to turn into:

          <tag k="highway" v="primary" />

(Before anyone asks, this is not for data that will result in any kind of importing into OSM! Am merely using the OSM toolchain, but with data coming from a shapefile.)

I can't work out from the Osmosis Tag transform documentation how to do this, if it is even possible.

I suppose I am thinking something along these lines, but this doesn't work:

      <translation>
        <name>Convert from Shapefile headings to OSM key-value pairs</name>
        <description>-</description>
        <match type="way">
          <tag k="Mode" v="(.+)" match_id="kv" />
          <tag k="Type" v="(.+)" match_id="kv" />
        </match>
        <output>
          <copy-unmatched />
          <tag from_match="kv" k="{1}" v="{2}" />
        </output>
      </translation>

asked 20 Jul '16, 16:25

fooquency's gravatar image

fooquency
765610
accept rate: 0%

edited 20 Jul '16, 16:32

I've no idea what you want to do with it after osmosis, but if the answer was "load it into a rendering database" note that osm2pgsql can do what you want via a lua script:

https://github.com/openstreetmap/osm2pgsql/blob/master/docs/lua.md

(20 Jul '16, 16:56) SomeoneElse ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×252

question asked: 20 Jul '16, 16:25

question was seen: 1,567 times

last updated: 20 Jul '16, 16:56

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum