Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-06 Thread Jo
Something went wrong, so here is the code:

#!/bin/jython
 '''
 RWN2Garmin.py  - Numbered networks to Garmin GPX file converter
 This code is released under the GNU General
 Public License v2 or later.

 The GPL v3 is accessible here:
 http://www.gnu.org/licenses/gpl.html

 The GPL v2 is accessible here:
 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

 It comes with no warranty whatsoever.

 This code illustrates how to use Jython to:
 * work with selected items or how to process all the primitives of a
 certain kind (node, way, relation)

 '''
 from javax.swing import JOptionPane, JDialog
 from java.awt.event import ActionListener, ActionEvent
 from org.openstreetmap.josm import Main
 import org.openstreetmap.josm.command as Command
 import org.openstreetmap.josm.data.osm.Node as Node
 import org.openstreetmap.josm.data.osm.Way as Way
 import org.openstreetmap.josm.data.osm.TagCollection as TagCollection
 import org.openstreetmap.josm.data.osm.DataSet as DataSet
 import time

 def getMapView():
 if Main.main and Main.main.map:
 return Main.main.map.mapView
 else:
 return None

 mv = getMapView()
 f = open('C:/export.gpx', 'w')
 f.write('?xml version=1.0 encoding=UTF-8 standalone=yes?\n')
 f.write('gpx xmlns=http://www.topografix.com/GPX/1/1; creator=OSM Route
 Manager version=1.1 xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
 http://www.topografix.com/GPX/1/1
 http://www.topografix.com/GPX/1/1/gpx.xsd;\n')
 f.write('!-- All data by OpenStreetMap, licensed under cc-by-sa-2.0 (
 http://creativecommons.org/licenses/by-sa/2.0/). --\n')
 if mv and mv.editLayer and mv.editLayer.data:
 #selectedNodes = mv.editLayer.data.getSelectedNodes()
 #selectedWays = mv.editLayer.data.getSelectedWays()
 selectedRelations = mv.editLayer.data.getSelectedRelations()

 if not(selectedRelations):
 JOptionPane.showMessageDialog(Main.parent, Please select a
 collection relation)
 else:
 # nodetype = Node().getType()
 print
 for collection in selectedRelations:
 print 'COLLECTION:', collection
 for member in collection.getMembers():
 print 'MEMBER:',member
 if member.isNode():
 node = member.getNode()
 coords = node.getCoor()
 lon = coords.getX()
 lat = coords.getY()
 rwn_ref = node.get('rwn_ref')
 f.write('\twpt lat=' + str(lat) + ' lon=' +
 str(lon) + '\n')
 if rwn_ref:
 f.write('\t\tname' + rwn_ref + '/name\n')
 f.write('\t/wpt\n')
 for member in collection.getMembers():
 if member.isRelation():
 routerelation = member.getRelation()
 f.write('\ttrk\n')
 networkname =  routerelation.get('network:name')
 if not(networkname): networkname =  ''
 note = routerelation.get('note')
 if not(note): note =  ''
 f.write('\t\tname' + networkname + ' ' + note +
 '/name\n')
 f.write('\t\tsrcOpenStreetMap.org/src\n')
 f.write('\t\ttypefoot/type\n')
 for routerelmember in routerelation.getMembers():
 if routerelmember.isWay():
 f.write('\t\ttrkseg\n')
 way=routerelmember.getWay()
 for waynode in way.getNodes():
  coords = waynode.getCoor()
  lon = coords.getX()
  lat = coords.getY()
  f.write('\t\t\ttrkpt lat=' + str(lat) +
 ' lon=' + str(lon) + ' /trkpt\n')

 f.write('\t\t/trkseg\n')
 f.write('\t/trk\n')
 f.write('/gpx\n')
 f.close()

___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-06 Thread Gerard Vanderveken

Not yet tested, but visuals looking good.
A few problems remarked:

   trkseg
   /trkseg
   trkseg
   /trkseg
These are empty tracksegments, probably from ways that were not loaded 
in JOSM at the time of export.

(Verification or ad-hoc loading possible?)

   trk
   nameZuid-Dijleland 516-517/name
   srcOpenStreetMap.org/src
   typefoot/type
   trkseg
   trkpt lat=50.8380263 lon=4.6383458 /trkpt
   trkpt lat=50.8380824 lon=4.6383702 /trkpt
   /trkseg
   trkseg
   trkpt lat=50.8399611 lon=4.6345633 /trkpt
   trkpt lat=50.8397422 lon=4.634788 /trkpt
   trkpt lat=50.8395173 lon=4.6352819 /trkpt
   trkpt lat=50.8390851 lon=4.6359434 /trkpt
   trkpt lat=50.8387191 lon=4.6365035 /trkpt
   trkpt lat=50.8383876 lon=4.6375474 /trkpt
   trkpt lat=50.8381468 lon=4.6382006 /trkpt
   trkpt lat=50.8380824 lon=4.6383702 /trkpt
   /trkseg
   /trk
/gpx
In this last track the tracksegments are in opposite directions, both 
ending with the middle node trkpt lat=50.8380824 lon=4.6383702 /trkpt

This should be ordered  to get one long way.
Relation manager has no problems in doing that:
http://osmrm.openstreetmap.de/relation.jsp?id=1689797
Click +   'download GPX' (GPX is with route points)
rte
name/
srcOpenStreetMap.org/src
typefoot/type
rtept lat=50.8380263 lon=4.6383458/
rtept lat=50.8380824 lon=4.6383702/
rtept lat=50.8381468 lon=4.6382006/
rtept lat=50.8383876 lon=4.6375474/
rtept lat=50.8387191 lon=4.6365035/
rtept lat=50.8390851 lon=4.6359434/
rtept lat=50.8395173 lon=4.6352819/
rtept lat=50.8397422 lon=4.634788/
rtept lat=50.8399611 lon=4.6345633/
/rte

Possible extensions for the code
- verifying it is a collection ralation
- file dialog to set map and name of exportfile

Regards,
Gerard

Jo wrote:


Now it also exports the routes of a collection relation as points:
...


___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-03 Thread Gerard Vanderveken

Alternative is in stead of a route to use track
?xml version=1.0 encoding=UTF-8 standalone=yes?
gpx xmlns=http://www.topografix.com/GPX/1/1; 
http://www.topografix.com/GPX/1/1 creator=OSM Route Manager 
version=1.1 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
http://www.w3.org/2001/XMLSchema-instance 
xsi:schemaLocation=http://www.topografix.com/GPX/1/1 
http://www.topografix.com/GPX/1/1/gpx.xsd; 
http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd
!-- All data by OpenStreetMap, licensed under cc-by-sa-2.0 
(http://creativecommons.org/licenses/by-sa/2.0/). --

   wpt lat=50.788708 lon=4.5839511
 name301/name
   /wpt
   wpt lat=50.788718 lon=4.5839521
 name302/name
   /wpt
   trk
   nameDijleland 301-302/name
   srcOpenStreetMap.org/src
   typefoot/type
   trkseg
 trkpt lat=50.788708 lon=4.5839511  /trkpt
 trkpt lat=50.788709 lon=4.5839515  /trkpt
   /trkseg
   trkseg
 trkpt lat=50.788709 lon=4.5839515  /trkpt
 trkpt lat=50.788718 lon=4.5839521  /trkpt
   /trkseg
   trk
   trk
   nameDijleland 302-303/name
   srcOpenStreetMap.org/src
   typefoot/type
   trkseg
 trkpt lat=50.788718 lon=4.5839521  /trkpt
 trkpt lat=50.788719 lon=4.5839525  /trkpt
 trkpt lat=50.788728 lon=4.5839531  /trkpt
   /trkseg
   /trk
/gpx

Advantage is the track segment trkseg element that matches the ways in 
the sub relations.

(and no need to filter out double nodes from start and end of these ways)

Regards,
Gerard.

Jo wrote:


That doesn't look too complicated, I'll look into it, tomorrow.

Jo

2011/8/2 Gerard Vanderveken g...@ghia.eu mailto:g...@ghia.eu

As a minimum you require an output file dijleland.gpx  like this
example

?xml version=1.0 encoding=UTF-8 standalone=yes?
gpx xmlns=http://www.topografix.com/GPX/1/1;
http://www.topografix.com/GPX/1/1 creator=OSM Route Manager
version=1.1
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd;

http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd
!-- All data by OpenStreetMap, licensed under cc-by-sa-2.0
(http://creativecommons.org/licenses/by-sa/2.0/). --
wpt lat=50.788708 lon=4.5839511
  name301/name
/wpt
wpt lat=50.788718 lon=4.5839521
  name302/name
/wpt
rte
nameDijleland 301-302/name
srcOpenStreetMap.org/src
typefoot/type
rtept lat=50.788708 lon=4.5839511  /rtept
rtept lat=50.788709 lon=4.5839515  /rtept
rtept lat=50.788718 lon=4.5839521  /rtept
/rte
rte
nameDijleland 302-303/name
srcOpenStreetMap.org/src
typefoot/type
rtept lat=50.788718 lon=4.5839521  /rtept
rtept lat=50.788719 lon=4.5839525  /rtept
rtept lat=50.788728 lon=4.5839531  /rtept
/rte
/gpx

For every node there is a waypoint element wpt with the
coordinates and as name its ref number
For every sub relation there is a  route element rte
It contains route points rtept.
These rtept are all the nodes of the ways from the subrelation.
The streets and their nodes  need to be ordered from start to end
node (the ones with the ref tag)
Regards,
Gerard


Jo wrote:


Gerard,

If you provide me with a detailed example of what data in the osm
file, needs to become which information in the gpx, I might try
to program this in Python. It's possible to add python scripts to
JOSM.

Jo (Polyglot)

2011/8/2 Gerard Vanderveken g...@ghia.eu mailto:g...@ghia.eu

It is not an obligation to have this 'not yet official'
collection relation.
I got the idea by looking at some Alp paths, where it was
used to link all paths of the network.

Everyone can add to the Wiki (registration and login required).
But if you feel uncomfortable doing edits in a Wiki , I can
do it for you, if you send me the relevant data.
The relation has to be created first, so the reference can be
put in the Wiki

For the creation of this specialised GPX, the exporting
functions of OSM are not suitabe.
There is some programming or script required to put each sub
relation into a route and convert the  nodes to waypoints.

Regards,
Gerard.

network (as far as they exist).

Should such a collection be created for all other
knooppunten networks ?
If so, can someone update the wiki page to reflect this,
so I can properly create and tag that collection for
Rivierenland

I downloaded the gpx file  from Zuid-Dijleland. I was

[OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-02 Thread Marc Gemis
I have added quite a few 'knooppunten' of the Rivierenland regional walking
network.
This information is not available through the Walking Routes wiki page.

Recently the Zuid-Dijleland network was added to the wiki page. Therefore
people created a
collection containing all nodes and routes of this network (as far as they
exist).

Should such a collection be created for all other knooppunten networks ?
If so, can someone update the wiki page to reflect this, so I can properly
create and tag that collection for Rivierenland

I downloaded the gpx file  from Zuid-Dijleland. I was hoping to get the
collection of knooppunten as waypoints.
The result was disappointing (import in Garmin RoadTrip). Too many routes,
even non-existing, waypoints without the number of the knooppunt.

Is there a better way to retrieve the information as GPX ? I would already
be happy with the knooppunten alone, without the routes between them.
I've tried exporting them from JOSM, but this also looses the number (which
only exists as rwn_ref).


Marc
___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-02 Thread Jo
Gerard,

If you provide me with a detailed example of what data in the osm file,
needs to become which information in the gpx, I might try to program this in
Python. It's possible to add python scripts to JOSM.

Jo (Polyglot)

2011/8/2 Gerard Vanderveken g...@ghia.eu

 It is not an obligation to have this 'not yet official' collection
 relation.
 I got the idea by looking at some Alp paths, where it was used to link all
 paths of the network.

 Everyone can add to the Wiki (registration and login required).
 But if you feel uncomfortable doing edits in a Wiki , I can do it for you,
 if you send me the relevant data.
 The relation has to be created first, so the reference can be put in the
 Wiki

 For the creation of this specialised GPX, the exporting functions of OSM
 are not suitabe.
 There is some programming or script required to put each sub relation into
 a route and convert the  nodes to waypoints.

 Regards,
 Gerard.

  network (as far as they exist).

 Should such a collection be created for all other knooppunten networks ?
 If so, can someone update the wiki page to reflect this, so I can properly
 create and tag that collection for Rivierenland

 I downloaded the gpx file  from Zuid-Dijleland. I was hoping to get the
 collection of knooppunten as waypoints.
 The result was disappointing (import in Garmin RoadTrip). Too many routes,
 even non-existing, waypoints without the number of the knooppunt.

 Is there a better way to retrieve the information as GPX ? I would already
 be happy with the knooppunten alone, without the routes between them.
 I've tried exporting them from JOSM, but this also looses the number
 (which only exists as rwn_ref).


 Marc

 --**--**
 

 __**_
 Talk-be mailing list
 Talk-be@openstreetmap.org
 http://lists.openstreetmap.**org/listinfo/talk-behttp://lists.openstreetmap.org/listinfo/talk-be




 __**_
 Talk-be mailing list
 Talk-be@openstreetmap.org
 http://lists.openstreetmap.**org/listinfo/talk-behttp://lists.openstreetmap.org/listinfo/talk-be

___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-02 Thread Gerard Vanderveken

As a minimum you require an output file dijleland.gpx  like this example

?xml version=1.0 encoding=UTF-8 standalone=yes?
gpx xmlns=http://www.topografix.com/GPX/1/1; creator=OSM Route 
Manager version=1.1 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://www.topografix.com/GPX/1/1 
http://www.topografix.com/GPX/1/1/gpx.xsd;
!-- All data by OpenStreetMap, licensed under cc-by-sa-2.0 
(http://creativecommons.org/licenses/by-sa/2.0/). --

   wpt lat=50.788708 lon=4.5839511
 name301/name
   /wpt
   wpt lat=50.788718 lon=4.5839521
 name302/name
   /wpt
   rte
   nameDijleland 301-302/name
   srcOpenStreetMap.org/src
   typefoot/type
   rtept lat=50.788708 lon=4.5839511  /rtept
   rtept lat=50.788709 lon=4.5839515  /rtept
   rtept lat=50.788718 lon=4.5839521  /rtept
   /rte
   rte
   nameDijleland 302-303/name
   srcOpenStreetMap.org/src
   typefoot/type
   rtept lat=50.788718 lon=4.5839521  /rtept
   rtept lat=50.788719 lon=4.5839525  /rtept
   rtept lat=50.788728 lon=4.5839531  /rtept
   /rte
/gpx

For every node there is a waypoint element wpt with the coordinates and 
as name its ref number

For every sub relation there is a  route element rte
It contains route points rtept.
These rtept are all the nodes of the ways from the subrelation.
The streets and their nodes  need to be ordered from start to end node 
(the ones with the ref tag)

Regards,
Gerard


Jo wrote:


Gerard,

If you provide me with a detailed example of what data in the osm 
file, needs to become which information in the gpx, I might try to 
program this in Python. It's possible to add python scripts to JOSM.


Jo (Polyglot)

2011/8/2 Gerard Vanderveken g...@ghia.eu mailto:g...@ghia.eu

It is not an obligation to have this 'not yet official' collection
relation.
I got the idea by looking at some Alp paths, where it was used to
link all paths of the network.

Everyone can add to the Wiki (registration and login required).
But if you feel uncomfortable doing edits in a Wiki , I can do it
for you, if you send me the relevant data.
The relation has to be created first, so the reference can be put
in the Wiki

For the creation of this specialised GPX, the exporting functions
of OSM are not suitabe.
There is some programming or script required to put each sub
relation into a route and convert the  nodes to waypoints.

Regards,
Gerard.

network (as far as they exist).

Should such a collection be created for all other knooppunten
networks ?
If so, can someone update the wiki page to reflect this, so I
can properly create and tag that collection for Rivierenland

I downloaded the gpx file  from Zuid-Dijleland. I was hoping
to get the collection of knooppunten as waypoints.
The result was disappointing (import in Garmin RoadTrip). Too
many routes, even non-existing, waypoints without the number
of the knooppunt.

Is there a better way to retrieve the information as GPX ? I
would already be happy with the knooppunten alone, without the
routes between them.
I've tried exporting them from JOSM, but this also looses the
number (which only exists as rwn_ref).


Marc



___
Talk-be mailing list
Talk-be@openstreetmap.org mailto:Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be
 




___
Talk-be mailing list
Talk-be@openstreetmap.org mailto:Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be




___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be
 

___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Knooppuntennetwerken (Regional walking networks)

2011-08-02 Thread Jo
That doesn't look too complicated, I'll look into it, tomorrow.

Jo

2011/8/2 Gerard Vanderveken g...@ghia.eu

 **
 As a minimum you require an output file dijleland.gpx  like this example

 ?xml version=1.0 encoding=UTF-8 standalone=yes?
 gpx 
 xmlns=http://www.topografix.com/GPX/1/1;http://www.topografix.com/GPX/1/1creator=OSM
  Route Manager version=1.1 xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance;http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation=http://www.topografix.com/GPX/1/1
 http://www.topografix.com/GPX/1/1/gpx.xsd;http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd
 
 !-- All data by OpenStreetMap, licensed under cc-by-sa-2.0 (
 http://creativecommons.org/licenses/by-sa/2.0/). --
 wpt lat=50.788708 lon=4.5839511
   name301/name
 /wpt
 wpt lat=50.788718 lon=4.5839521
   name302/name
 /wpt
 rte
 nameDijleland 301-302/name
 srcOpenStreetMap.org/src
 typefoot/type
 rtept lat=50.788708 lon=4.5839511  /rtept
 rtept lat=50.788709 lon=4.5839515  /rtept
 rtept lat=50.788718 lon=4.5839521  /rtept
 /rte
 rte
 nameDijleland 302-303/name
 srcOpenStreetMap.org/src
 typefoot/type
 rtept lat=50.788718 lon=4.5839521  /rtept
 rtept lat=50.788719 lon=4.5839525  /rtept
 rtept lat=50.788728 lon=4.5839531  /rtept
 /rte
 /gpx

 For every node there is a waypoint element wpt with the coordinates and as
 name its ref number
 For every sub relation there is a  route element rte
 It contains route points rtept.
 These rtept are all the nodes of the ways from the subrelation.
 The streets and their nodes  need to be ordered from start to end node (the
 ones with the ref tag)
 Regards,
 Gerard


 Jo wrote:

 Gerard,

 If you provide me with a detailed example of what data in the osm file,
 needs to become which information in the gpx, I might try to program this in
 Python. It's possible to add python scripts to JOSM.

 Jo (Polyglot)

 2011/8/2 Gerard Vanderveken g...@ghia.eu

 It is not an obligation to have this 'not yet official' collection
 relation.
 I got the idea by looking at some Alp paths, where it was used to link all
 paths of the network.

 Everyone can add to the Wiki (registration and login required).
 But if you feel uncomfortable doing edits in a Wiki , I can do it for you,
 if you send me the relevant data.
 The relation has to be created first, so the reference can be put in the
 Wiki

 For the creation of this specialised GPX, the exporting functions of OSM
 are not suitabe.
 There is some programming or script required to put each sub relation into
 a route and convert the  nodes to waypoints.

 Regards,
 Gerard.

  network (as far as they exist).

 Should such a collection be created for all other knooppunten networks ?
 If so, can someone update the wiki page to reflect this, so I can
 properly create and tag that collection for Rivierenland

 I downloaded the gpx file  from Zuid-Dijleland. I was hoping to get the
 collection of knooppunten as waypoints.
 The result was disappointing (import in Garmin RoadTrip). Too many
 routes, even non-existing, waypoints without the number of the knooppunt.

 Is there a better way to retrieve the information as GPX ? I would
 already be happy with the knooppunten alone, without the routes between
 them.
 I've tried exporting them from JOSM, but this also looses the number
 (which only exists as rwn_ref).


 Marc

  

 ___
 Talk-be mailing list
 Talk-be@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk-be




 ___
 Talk-be mailing list
 Talk-be@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk-be


  --

 ___
 Talk-be mailing 
 listTalk-be@openstreetmap.orghttp://lists.openstreetmap.org/listinfo/talk-be


___
Talk-be mailing list
Talk-be@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-be