Rub21 / geojson2osm

Convert geojson to osm
6 stars 4 forks source link

Changeset attribute cause issues with JOSM #8

Open DenisCarriere opened 8 years ago

DenisCarriere commented 8 years ago

Mentioned by @james2432

A node should have action='modify' and id='-1'

JOSM warning/errors

Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -1. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -1. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -2. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -2. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -3. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -3. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -4. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -4. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -5. Got false. Resetting to 0.
Sep 15, 2016 12:00:31 PM org.openstreetmap.josm.Main info
INFO: Illegal value for attribute 'changeset' on new object -5. Got false. Resetting to 0.

OSM File created by geojson2osm

<osm version="0.6" generator="https://github.com/Rub21/geojson2osm">
  <node lat="45.468486" lon="-75.458391" id="-1" changeset="false">
    <tag k="addr:housenumber" v="1999"/>
    <tag k="amenity" v="school"/>
    <tag k="addr:postcode" v="K4A 3Y6"/>
    <tag k="name" v="Pavillon Béatrice-Desloges"/>
    <tag k="isced:level" v="2"/>
    <tag k="school:jurisdiction" v="Orléans"/>
    <tag k="source" v="CECCE"/>
    <tag k="source:ref" v="CECCE"/>
    <tag k="operator" v="Conseil des écoles catholiques du Centre-Est"/>
    <tag k="religion" v="christian"/>
    <tag k="addr:street" v="Provence Avenue"/>
    <tag k="addr:street:fr" v="Avenue Provence"/>
    <tag k="ref" v="705276"/>
    <tag k="school:language" v="french"/>
    <tag k="contact:twitter" v="@ecolecatholique"/>
    <tag k="contact:facebook" v="ecolecatholique"/>
  </node>
  <node lat="45.468486" lon="-75.458391" id="-2" changeset="false">
    <tag k="addr:housenumber" v="1999"/>
    <tag k="amenity" v="school"/>
    <tag k="addr:postcode" v="K4A 3Y6"/>
    <tag k="name" v="École secondaire catholique Béatrice-Desloges"/>
    <tag k="isced:level" v="3"/>
    <tag k="school:jurisdiction" v="Orléans"/>
    <tag k="source" v="CECCE"/>
    <tag k="source:ref" v="CECCE"/>
    <tag k="operator" v="Conseil des écoles catholiques du Centre-Est"/>
    <tag k="religion" v="christian"/>
    <tag k="addr:street" v="Provence Avenue"/>
    <tag k="addr:street:fr" v="Avenue Provence"/>
    <tag k="ref" v="705314"/>
    <tag k="school:language" v="french"/>
    <tag k="contact:twitter" v="@ecolecatholique"/>
    <tag k="contact:facebook" v="ecolecatholique"/>
  </node>
  <node lat="45.471413" lon="-75.470837" id="-3" changeset="false">
    <tag k="addr:housenumber" v="1830"/>
    <tag k="amenity" v="school"/>
    <tag k="addr:postcode" v="K4A 3T6"/>
    <tag k="name" v="École élémentaire catholique Arc-en-ciel"/>
    <tag k="isced:level" v="2"/>
    <tag k="school:jurisdiction" v="Orléans"/>
    <tag k="source" v="CECCE"/>
    <tag k="source:ref" v="CECCE"/>
    <tag k="operator" v="Conseil des écoles catholiques du Centre-Est"/>
    <tag k="religion" v="christian"/>
    <tag k="addr:street" v="Portobello Boulevard"/>
    <tag k="addr:street:fr" v="Boulevard Portobello"/>
    <tag k="ref" v="705047"/>
    <tag k="school:language" v="french"/>
    <tag k="contact:twitter" v="@ecolecatholique"/>
    <tag k="contact:facebook" v="ecolecatholique"/>
  </node>
  <node lat="45.464899" lon="-75.461491" id="-4" changeset="false">
    <tag k="addr:housenumber" v="866"/>
    <tag k="amenity" v="school"/>
    <tag k="addr:postcode" v="K4A 4T6"/>
    <tag k="name" v="École élémentaire catholique de la Découverte"/>
    <tag k="isced:level" v="2"/>
    <tag k="school:jurisdiction" v="Orléans"/>
    <tag k="source" v="CECCE"/>
    <tag k="source:ref" v="CECCE"/>
    <tag k="operator" v="Conseil des écoles catholiques du Centre-Est"/>
    <tag k="religion" v="christian"/>
    <tag k="addr:street" v="Scala Avenue"/>
    <tag k="addr:street:fr" v="Avenue Scala"/>
    <tag k="ref" v="705390"/>
    <tag k="school:language" v="french"/>
    <tag k="contact:twitter" v="@ecolecatholique"/>
    <tag k="contact:facebook" v="ecolecatholique"/>
  </node>
  <node lat="45.473832" lon="-75.481621" id="-5" changeset="false">
    <tag k="addr:housenumber" v="720"/>
    <tag k="amenity" v="school"/>
    <tag k="addr:postcode" v="K4A 1L8"/>
    <tag k="name" v="École élémentaire catholique des Pionniers"/>
    <tag k="isced:level" v="2"/>
    <tag k="school:jurisdiction" v="Orléans"/>
    <tag k="source" v="CECCE"/>
    <tag k="source:ref" v="CECCE"/>
    <tag k="operator" v="Conseil des écoles catholiques du Centre-Est"/>
    <tag k="religion" v="christian"/>
    <tag k="addr:street" v="Merkley Drive"/>
    <tag k="addr:street:fr" v="Promenade Merkley"/>
    <tag k="ref" v="703168"/>
    <tag k="school:language" v="french"/>
    <tag k="contact:twitter" v="@ecolecatholique"/>
    <tag k="contact:facebook" v="ecolecatholique"/>
  </node>
</osm>
DenisCarriere commented 8 years ago

@james2432 Changing all the id=-1 doesn't solve it, now all of the features converge into a single node. I think this issue is with JOSM and not geojson2osm, this project has been forked many times.

1st: https://gist.github.com/tecoholic/1396990 written by @tecoholic 2nd: https://github.com/aaronlidman/osm-and-geojson written by @aaronlidman

I'm sure they have valid reasons why the XML is in this format.

james2432 commented 8 years ago

@DenisCarriere No the id should be incremental... -1 -2 -3 -4 -5 -6.... but the changeset attribute is the problem. it should have instead action='modify'

TL;DR : replace changeset="false" with action='modify'

Changeset should only be set to a positive integer when it has been uploaded to the OpenStreetMap database

DenisCarriere commented 8 years ago

@james2432 Oh that makes sense, i'll test it out.

DenisCarriere commented 8 years ago

This "patch" works for my particular use case.

geojson2osm(geojson).replace(/changeset="false"/, 'action=\"modifiy\"')