convert a set of ways to a GPX layer

Jo winfixit at gmail.com
Mon Jul 13 19:35:12 UTC 2020


There is also this:

https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java

But I don't know how to use it.

Jo

On Mon, Jul 13, 2020 at 8:51 PM Jo <winfixit at gmail.com> wrote:

> public static void removeOnewayAndSplitRoundaboutWays(final Relation r) {
>     if (isPTRoute(r)) {
>         GpxData gpxOfItinerary = new GpxData();
>         for (RelationMember nestedRelationMember : r.getMembers()) {
>             if (nestedRelationMember.getType().equals(OsmPrimitiveType.WAY)) {
>                 GpxTrack gpxTrack = new GpxTrack();
>                 if (nestedRelationMember.getWay().hasTag("oneway", "yes") ||
>                     (nestedRelationMember.getWay().hasTag("junction", "roundabout") &&
>                         !nestedRelationMember.getWay().isClosed()
>                     )
>                 )
>             {
>                 r.removeMembersFor(nestedRelationMember.getWay());
>             }
>             }
>         }
>         GpxLayer gpx = new GpxLayer(gpxOfItinerary, "GPX of itinerary");
>
> So this is how far I got. I didn't try to run it, but I think the last
> line will create my GPX layer.
>
>  So now I need to figure out how to convert OSM ways to GPX tracks
>
> Jo
>


More information about the josm-dev mailing list