Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagTransform support in map writer #17

Closed
boldtrn opened this issue Jan 16, 2018 · 6 comments
Closed

TagTransform support in map writer #17

boldtrn opened this issue Jan 16, 2018 · 6 comments

Comments

@boldtrn
Copy link
Contributor

boldtrn commented Jan 16, 2018

It would be great if we could specify a tag transform file before generating the map file.

Not sure if we have a best practice for mapsforge at this moment? But it would be great to add this as user option.

Something like:

if(path-to-tag-transform-file-given)
  run tag-transform
@devemux86
Copy link
Collaborator

Thanks for the very nice suggestion!

TagTransform plugin is now integrated in Osmosis built-in tasks, so can use it via --tag-transform (--tt) option.
I'll add an environment variable to make its use convenient.

@devemux86 devemux86 changed the title Optionally run tag transform after downloading TagTransform support in map writer Jan 17, 2018
@boldtrn
Copy link
Contributor Author

boldtrn commented Jan 18, 2018

I tried this and always received an exception. I just used the example transform file found here.

I then moved the --tt call from the mapwriter call to the merge call like this:

# Merge

CMD="$OSMOSIS_HOME/bin/osmosis --rb file=$WORK_PATH/$NAME-latest.osm.pbf \
                               --rx file=$WORK_PATH/sea.osm --s --m"
for f in $WORK_PATH/land*.osm; do
  CMD="$CMD --rx file=$f --s --m"
done
[ $MAP_TRANSFORM_FILE ] && CMD="$CMD --tt file=$MAP_TRANSFORM_FILE"
CMD="$CMD --wb file=$WORK_PATH/merge.pbf omitmetadata=true"
echo $CMD
$CMD

This seems to work. It looks like it's not possible to use tag transform together with mapwriter in one call? BTW: I used the latest mapwriter. Below you can find the transform file I used.

<?xml version="1.0"?>
<translations>
 
  <translation>
    <name>Simplify Access</name>
    <description>Simplifies the access restrictions to yes/no. We could limit for specific keys, but lets live dangerously.</description>
    <match mode="or">
      <tag k=".*" match_id="yes" v="true|designated|public|permissive"/>
      <tag k=".*" match_id="no" v="false|private|privat"/>
    </match>
    <output>
      <copy-all/>
      <tag from_match="yes" v="yes"/>
      <tag from_match="no" v="no"/>
    </output>
  </translation>
  
</translations>

devemux86 added a commit that referenced this issue Jan 18, 2018
@devemux86
Copy link
Collaborator

Thanks for the report!

It's usable with map-writer, I pushed the fix.
Had to improve Osmosis tasks pipeline in that call. 🙂

@boldtrn
Copy link
Contributor Author

boldtrn commented Jan 18, 2018

Thanks, I will have a look with the next import :).

@ravivarmahattaraki
Copy link

I am stuck with below exception please help me out

java.lang.RuntimeException: more than 15 tags aren't supported
at org.mapsforge.map.writer.MapFileWriter.infoBytePoiLayerAndTagAmount(MapFileWriter.java:455)
at org.mapsforge.map.writer.MapFileWriter.processPOI(MapFileWriter.java:517)
at org.mapsforge.map.writer.MapFileWriter.processTile(MapFileWriter.java:861)
at org.mapsforge.map.writer.MapFileWriter.writeSubfile(MapFileWriter.java:977)
at org.mapsforge.map.writer.MapFileWriter.writeFile(MapFileWriter.java:375)
at org.mapsforge.map.writer.osmosis.MapFileWriterTask.complete(MapFileWriterTask.java:113)
at org.openstreetmap.osmosis.tagtransform.impl.TransformHelper.complete(TransformHelper.java:95)
at crosby.binary.osmosis.OsmosisBinaryParser.complete(OsmosisBinaryParser.java:35)
at org.openstreetmap.osmosis.osmbinary.file.BlockInputStream.process(BlockInputStream.java:37)
at crosby.binary.osmosis.OsmosisReader.run(OsmosisReader.java:45)
at java.base/java.lang.Thread.run(Thread.java:832)

@devemux86
Copy link
Collaborator

devemux86 commented Jul 1, 2021

For questions and reports please use the Discussions.

java.lang.RuntimeException: more than 15 tags aren't supported

The message is quite explanatory, you cannot store more than 15 tags per element.
(more details in the old forum)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants