potree / PotreeConverter

Create multi res point cloud to use with potree
http://potree.org
BSD 2-Clause "Simplified" License
643 stars 413 forks source link

json.exception.type_error UTF8 when converting .laz file on Ubuntu #587

Open thes3m opened 1 year ago

thes3m commented 1 year ago

Hi,

I get an exception when converting .las file with potree converter 2.0. Potree converter was build from source in ubuntu:20:04 docker container. Sometimes the command goes through when fiddling with locales, however I could not figure out exact issue why it is not working. Here is the log:

/app/potree-converter/nix/PotreeConverter /app/temp/1d60644c-d75e-484b-a496-9a9e713072e7/3-6-2-3.laz -o /app/tem
p/1d60644c-d75e-484b-a496-9a9e713072e7/output
#threads: 12
#paths: 1

output attributes:
name                              offset    size
================================================
position                               0      12
intensity                             12       2
return number                         14       1
number of returns                     15       1
classification                        16       1
scan angle rank                       17       1
user data                             18       1
point source id                       19       2
gps-time                              21       8
rgb                                   29       6
OriginId                              35       4
================================================
                                              39
================================================
cubicAABB: {
        "min": [482634.280000, 4390427.500000, 1860.920000],
        "max": [482744.780000, 4390538.000000, 1971.420000],
        "size": [110.500000, 110.500000, 110.500000]
}
#points: 57'658
total file size: 189'295.0 bytes
target directory: '/app/temp/1d60644c-d75e-484b-a496-9a9e713072e7/output'
maxPointsPerChunk: 2882

=======================================
=== COUNTING
=======================================
tStartTaskAssembly: 0.001804s
countPointsInCells: 0.149402s
finished counting in 0s
=======================================
createLUT: 0.235619s

=======================================
=== CREATING CHUNKS
=======================================
distributePoints0: 0.000773s
distributePoints1: 0.000812s
finished creating chunks in 0s
=======================================
terminate called after throwing an instance of 'nlohmann::detail::type_error'
  what():  [json.exception.type_error.316] invalid UTF-8 byte at index 33: 0xC2
Aborted

It looks like there is some sort of issue writing a log.txt file, because it is empty but I might be wrong. Also when running a command multiple times the "index" changes a bit, therefore it probably isn't related to the file that is beeing processed. Sometimes the conversion is successful but I can't say why.

I also tried converting the file on Windows and the conversion is successful.

Any help or workaround for this issue would be appriciated.

Thanks

abhemanyus commented 1 year ago

I am facing a similar issue


root@8c2bb88a7a4f:/data/build# ./PotreeConverter /server/assets/newortho.tif -o new_ortho
#threads: 4
#paths: 0

output attributes: 
name                              offset    size
================================================
================================================
                                               0
================================================
cubicAABB: {
        "min": [inf, inf, inf],
        "max": [-nan, -nan, -nan],
        "size": [-inf, -inf, -inf]
}
#points: 0
total file size: 0.0 bytes
target directory: 'new_ortho'
maxPointsPerChunk: 0

=======================================
=== COUNTING                           
=======================================
tStartTaskAssembly: 0.000001s
countPointsInCells: 0.013982s
finished counting in 0s
=======================================
createLUT: 0.042365s

=======================================
=== CREATING CHUNKS                    
=======================================
distributePoints0: 0.000119s
distributePoints1: 0.000130s
finished creating chunks in 0s
=======================================

=======================================
=== INDEXING                           
=======================================
terminate called after throwing an instance of 'nlohmann::detail::type_error'
  what():  [json.exception.type_error.302] type must be number, but is null
Aborted (core dumped)```

Is there a json file that the executable depends on somewhere, that is missing?
wellsmile commented 1 year ago

I hava the same question

wwwouter commented 1 year ago

I'm facing the same problem with a .LAS file of 2.6 GB with a build from develop (8123da7b7df69dd2b55434e0e649667e4c1846f1) on ubuntu:22.04.

Have been testing with other files, with different sizes and this is the only one that keeps failing. So for me it's not flaky as with @thes3m

It does work on 1.6 (4e393bff030c3cf89a8fb581a2bebff28bded799)

command: /opt/PotreeConverter/build/PotreeConverter
params: 
  - /tmp/file.las
  - -o
  - /opt/bda3b9bf-41aa-49b1-9cef-d532cd22969c
  - --projection
  - 
  - --overwrite
  - --encoding
  - BROTLI
threads: 4
paths: 1
output attributes: 
name                              offset    size
================================================
position                               0      12
intensity                             12       2
return number                         14       1
number of returns                     15       1
classification                        16       1
scan angle rank                       17       1
user data                             18       1
point source id                       19       2
rgb                                   21       6
================================================
                                              27
================================================
cubicAABB: {
    "min": [-20.218708, -14.551753, 37.015987],
    "max": [32.527519, 38.194474, 89.762215],
    "size": [52.746227, 52.746227, 52.746227]
}
#points: 105'463'618
total file size: 2.6 GB

...

[63%, 13s], [DISTRIBUTING: 90%, duration: 10s, throughput: 10MPs][RAM: 1.0GB (highest 1.1GB), CPU: 98%]
finished creating chunks in 11s
=======================================

=======================================
=== INDEXING                           
=======================================
terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what():  [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal
wwwouter commented 1 year ago

Nevermind. Because of this issue https://github.com/nlohmann/json/issues/1583 I tried added some language settings to my Dockerfile and it works now.

ENV LANG=en_US.utf-8
ENV LC_ALL=en_US.utf-8
chwu-rwth commented 1 year ago

@wwwouter i was having the same issue, even after adding the following:

ENV LANG=en_US.utf-8 ENV LC_ALL=en_US.utf-8

I have followed this git potreeconverte and built my own image, but i still get the above error. Any idea?

wwwouter commented 1 year ago

This is the Dockerfile that I'm using. I'm also running Node.js, so it's probably more than you need:

FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Amsterdam
ENV LANG=en_US.utf-8
ENV LC_ALL=en_US.utf-8

# Base packages
RUN apt-get update && \
    apt-get install --no-install-recommends -yq tzdata wget curl nano  && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# PotreeConverter build packages
RUN apt-get update && apt-get install -y \
    cmake g++ git libtbb-dev libtbb-dev && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Node packages
RUN apt-get update && \
    apt-get install --no-install-recommends -yq apt-transport-https postgresql-client libpq-dev xvfb zip software-properties-common graphicsmagick \
    libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
    libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
    libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1  \
    libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
    libnss3  curl && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# NODE
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN  apt-get install --no-install-recommends -yq  nodejs && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN node -v
RUN npm -v

WORKDIR /opt

RUN git clone https://github.com/potree/PotreeConverter.git

# PotreeConverter
#  6cd121bc92b279461dd4116283939ae0067f4aa1 = version 2.1
#  d9387d52807bf8936fe98096b9992ea13b50ba94 = latest develop Dec 2, 2022
RUN cd PotreeConverter && git checkout d9387d52807bf8936fe98096b9992ea13b50ba94 && mkdir build && cd build && \
    cmake ../ && \
    make

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm ci --omit=dev

COPY ./build/ .

CMD node index.js
nikste commented 2 months ago

did anyone find a different working solution here? Ran into the same problem and the docker code above does not seem to fix it for me ..

danielgormly commented 1 month ago

I landed here because I was pointing to a non-existent input file!

terminate called after throwing an instance of 'nlohmann::detail::type_error' what(): [json.exception.type_error.302] type must be number, but is null