Up3date icon indicating copy to clipboard operation
Up3date copied to clipboard

Using LOD subversion numbers problem in CityJSON output

Open sambaas opened this issue 4 years ago • 5 comments

Using LOD subversions gives a problem in the json output. It looks like the part of the name is not stripped out properly (The two extra characters for the decimal character seem to be ignored when removing the '[LOD2.1]' part of the name.

{
    "type": "CityJSON",
    "version": "1.0",
    "metadata": {
        "geographicalExtent": [121578.775, 486020.60199999996, -4.7540000000000004, 121966.761, 486232.568, 309.487]
    },
    "CityObjects": {
        "] Cube": {
            "geometry": [{
                    "type": "MultiSurface",
                    "boundaries": [[[0, 1, 2, 3]], [[3, 2, 4, 5]], [[5, 4, 6, 7]], [[7, 6, 1, 0]], [[3, 5, 7, 0]], [[4, 2, 1, 6]]],
                    "lod": 2
                }
            ]
        },
        "Cube": {
            "geometry": [],
            "type": "Building"
        }
    },
    "vertices": [[236940.0, 60919.0, 163194.0], [236940.0, 60919.0, 314241.0], [236940.0, 211966.0, 314241.0], [236940.0, 211966.0, 163194.0], [387986.0, 211966.0, 314241.0], [387986.0, 211966.0, 163194.0], [387986.0, 60919.0, 314241.0], [387986.0, 60919.0, 163194.0]],
    "transform": {
        "scale": [0.001, 0.001, 0.001],
        "translate": [121578.775, 486020.60199999996, -4.7540000000000004]
    }
}

sambaas avatar Jan 06 '22 13:01 sambaas

It appears to be line 260 in objects.py, because a hardcoded length is stripped off to get the ID: CityObject_id = objid[10:]

Getting the part after the second space should fix this. I'll see if that works and make a pull request.

sambaas avatar Jan 06 '22 13:01 sambaas

Made a pull request https://github.com/cityjson/Up3date/pull/17

sambaas avatar Jan 06 '22 14:01 sambaas

Thanks a lot for raising the issue and submitting the PR! I'll review the fix and let you know.

liberostelios avatar Jan 06 '22 14:01 liberostelios

That is indeed an improvement. Back in the day when developing the add-on I never thought of decimal point LODs :-). Thanks Sam!

konmast3r avatar Jan 06 '22 14:01 konmast3r

Tbf, at that point extended LoDs weren't really supported that well in the CityJSON specs. Thankfully, this is fixed now!

liberostelios avatar Jan 06 '22 14:01 liberostelios