[josm-dev] In josm load/save format how to specify changeset information?

Bryce Nesbitt bryce2 at obviously.com
Sat Aug 27 07:06:47 BST 2011


On 08/26/2011 06:40 AM, André Riedel wrote:
> 2011/8/26 Bryce Nesbitt<bryce2 at obviously.com>:
>> If not what syntax would make sense?
> I would prefer something like this: [1] (Changeset syntax)
>
> <?xml version='1.0' encoding='UTF-8'?>
> <osm version='0.6' generator='JOSM'>
>    <changeset>
>      <tag k="created_by" v="JOSM 1.61"/>
>      <tag k="comment" v="osmchange script to import dog poop sighting database"/>
>      <tag k="source" v="Par-tay"/>
>      <tag k="source:website" v="http://dataimport.org/dataset.kml"/>
>    </changeset>
>    <node id='-3' action='modify' visible='true'
> lat='1.3698003002266779' lon='-1.235183515664342'>
>      <tag k='access' v='foo' />
>    </node>
> ...
> </osm>

Ok, I was able to partially implement that, adding to the DataSet and 
parsing it.

Would a josm intermediate to advanced developer be willing to help 
finish the patch?
It is murky how to populate the stored <changeset> tags in the 
TagSettingsPanel,
and what to do if two layers specify different changeset tags.


===================================================================
--- src/org/openstreetmap/josm/io/OsmImporter.java    (revision 4348)
+++ src/org/openstreetmap/josm/io/OsmImporter.java    (working copy)
@@ -41,6 +41,11 @@
      protected void importData(InputStream in, File associatedFile) 
throws IllegalDataException {
          DataSet dataSet = OsmReader.parseDataSet(in, 
NullProgressMonitor.INSTANCE);
          final OsmDataLayer layer = new OsmDataLayer(dataSet, 
associatedFile.getName(), associatedFile);
+        System.out.println("Bryce start");
+        //System.out.println(dataSet.toString());
+        System.out.println(dataSet.getChangeSet());
+        System.out.println("Bryce end");
+
          // FIXME: remove UI stuff from IO subsystem
          //
          Runnable uiStuff = new Runnable() {

Index: src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/DataSet.java    (revision 4348)
+++ src/org/openstreetmap/josm/data/osm/DataSet.java    (working copy)
@@ -206,6 +206,17 @@
          this.version = version;
      }

+    /*
+     * Holding bin for changeset tag information, to be applied when or 
if this is ever uploaded.
+     */
+    private HashMap changeSetTags = new HashMap();
+    public HashMap getChangeSet() {
+        return changeSetTags;
+    }
+    public void addChangeSetTag(String k, String v) {
+        this.changeSetTags.put(k,v);
+    }
+
      /**
       * All nodes goes here, even when included in other data (ways 
etc). This enables the instant
       * conversion of the whole DataSet by iterating over this data 
structure.




More information about the josm-dev mailing list