cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
126 stars 32 forks source link

Opening 3DBAG CityJSON with cjio gives ValueError: Invalid CRS string #155

Closed Davidswinkels closed 1 year ago

Davidswinkels commented 1 year ago

Describe the bug After downloading https://data.3dbag.nl/cityjson/v210908_fd2cee53/3dbag_v210908_fd2cee53_5907.json, and trying to open it with cjio via cli or in Python directly it throws error:

Traceback (most recent call last):
  File "C:\Users\301650\.conda\envs\geodata\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\301650\.conda\envs\geodata\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\301650\.conda\envs\geodata\Scripts\cjio.exe\__main__.py", line 7, in <module>
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\click\core.py", line 1689, in invoke
    return _process_result(rv)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\click\core.py", line 1626, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\cjio\cjio.py", line 94, in process_pipeline
    cm = processor(cm)
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\cjio\cjio.py", line 103, in processor
    s = linesep.join(cm.get_info(long=long))
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\cjio\cityjson.py", line 972, in get_info
    s.append("EPSG = {}".format(self.get_epsg()))
  File "C:\Users\301650\.conda\envs\geodata\lib\site-packages\cjio\cityjson.py", line 442, in get_epsg
    raise ValueError(f"Invalid CRS string '{s}'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{{authority}}/{{version}}/{{code}}'")
ValueError: Invalid CRS string 'urn:ogc:def:crs:EPSG::7415'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{authority}/{version}/{code}'

cjio version cjio v0.8.0; supports CityJSON v1.1

To Reproduce

  1. Download file from: https://data.3dbag.nl/cityjson/v210908_fd2cee53/3dbag_v210908_fd2cee53_5907.json
  2. Install cjio in python environment: pip install cjio
  3. Run cjio: cjio .\3dbag_v210908_fd2cee53_5907.json info --long

Expected behavior Correct loading of files without CRS issue.

Desktop (please complete the following information):

hugoledoux commented 1 year ago

The 3dbag files are still in v1.0 and cjio only handles v1.1

First upgrade the file(s) with the command/warning in red just above what you pasted here

SCR-20230112-gp8