TimSC / pycrocosm

OSM API v0.6 implemented in Django/Python
9 stars 4 forks source link

new objects with version=1 not accepted #19

Closed 4x4falcon closed 6 years ago

4x4falcon commented 6 years ago

This did work previously. If you attempt to upload a new node/way/relation that has a version attribute greater than zero or null. The error message from journalctl -u pycrocosm.service is: uwsgi-core[23269]: Version for created objects must be null or zero

Following is an example node:

<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="Osmosis 0.40.1">
  <node id="-1764291" version="1" timestamp="2017-01-12T17:57:25Z" lat="-36.9205172" lon="148.735569">
    <tag k="addr:housenumber" v="616"/>
    <tag k="addr:street" v="Tingaringi Road"/>
    <tag k="addr:city" v="Corrowong"/>
    <tag k="addr:state" v="NSW"/>
    <tag k="addr:postcode" v="2633"/>
    <tag k="addr:country" v="AU"/>
  </node>
</osm>

This is an extract from gnaf address data.

If the version="1" in the node attributes is removed it will upload correctly.

Same occurs if using scanaerial external tool in josm.

I think if the following at line 128 in pycrocosm/changeset/views.py if obj.metaData.version != 0: is changed to if obj.metaData.version > 1:

this would resolve the issue.

It would be valid to upload a new object with a version of 1 so long as it is not incremented after upload.

TimSC commented 6 years ago

@4x4falcon I made the suggested change and added more unit tests. Can you please give this a test?

4x4falcon commented 6 years ago

Works fine. Can be closed.