jywarren/cartagen

merge() being called in collect_ways() but merge() doesn't exist

Opened this issue · 0 comments

Orig code:

collect_ways: function() {
    this.members.each(function(member) {
        this.nodes = member.nodes.concat(this.nodes)
        if (member.tags.size() > 0) this.tags.merge(member.tags)
    },this)
},

I'm guessing that the map-layer files I'm generating are enough different from the standard files that this bug was uncovered.

Unfortunately I don't understand the code well enough to suggest a real fix.
Here's my workaround so that the code doesn't crash - I "merge" the tags:

collect_ways: function() {
    this.members.each(function(member) {
        this.nodes = member.nodes.concat(this.nodes);
        if (member.tags.size() > 0)        // if there are member.tags
        {                                  // then merge them into this.tags
            for (let member_tags_key in member.tags._object)  // for all tags found in member.tags
            {                                                 // see if the member tag needs to be copied to this.tags
                if (isUndefined(this.tags[member_tags_key]))      // if the tag from member.tags is not in this.tags
                {                                                 // then copy it to this.tags
                    this.tags[member_tags_key] = member.tags._object[member_tags_key];
                }
            }
      }
    },this)
},

Maybe I've got this all wrong and there really is a merge() method.
If so, please set me right.
Or please suggest a real fix for this problem.
Thanks.