Need help with pnts format.

559 views
Skip to first unread message

winte...@gmail.com

unread,
Jun 6, 2017, 3:14:47 AM6/6/17
to cesium-dev

Hi, all

 


I want to change the point cloud data stored in ASCII format using C ++ to the pnts binary format used by Cesium (http://cesiumjs.org).

 

I’m having difficulty in creating a binary format file using specification information because I do not have enough understanding about data types and binary files.

 

The specification of the pnts format and the attribute information of the header are shown in Figure 1 and 2.


Figure 1



Figure 2



Currently, I’m analyzing the header portion of the binary-formatted sample file (test.points) and the results are shown in Figure 3.


The contents of the pnts file were changed to hexadecimal notation using Notepad ++, and these values were converted to decimal digits and confirmed.

 

Figure 3



 magic, version, and byteLength are interpreted correctly, but the remaining FeatureTableJSONByteLength, FeatureTableBinaryByteLength, batchTableJSONByteLength, and batchTableBinaryByteLength are much larger than I expected.

 

In the description of the header field above, I thought that the size of the byte buffer of FeatureTableJSONByteLength would not exceed the total byte length, but it was too large.


Please comment whether I misinterpreted it or if it was generated differently when creating the sample file, or if the approach was wrong when creating the file using the format specification.

 

Thank U 

Sean Lilley

unread,
Jun 6, 2017, 8:12:35 PM6/6/17
to cesium-dev
Which test.pnts file are you referring to?
Message has been deleted

winte...@gmail.com

unread,
Jun 8, 2017, 1:39:19 AM6/8/17
to cesium-dev
 


{
"asset": {
"version": "0.0"
},
"geometricError": 10000,
"refine": "add",
"root": {
"boundingVolume": {
"sphere": [-2505606.7412357354,
-3847564.4813386216,
4412182.937547942,
100]
},
"geometricError": 0,
"content": {
"url": "s-0001.pnts"
},
"children": []
}
}                                           json format.
 
 
I uploaded only one of several files.
Thanks.


Sean Lilley

unread,
Jun 8, 2017, 6:51:02 PM6/8/17
to cesium-dev
I'm not sure what to suggest. It seems like a bug in the tool that created the .pnts file.

winte...@gmail.com

unread,
Jun 16, 2017, 2:22:12 AM6/16/17
to cesium-dev
I'm sorry to see you reply late.

But what is the exact meaning of the bug?

Sean Lilley

unread,
Jun 17, 2017, 1:46:34 PM6/17/17
to cesium-dev
I could help find the bug, but I would need to see the code that generates the pnts files.
Message has been deleted

Wonwoo Seo

unread,
Jun 19, 2017, 1:16:06 AM6/19/17
to cesium-dev
Thank you for answer.

pnts sample data in this post is from following site.

If there is a bug in this pnts file, could you provide me a sample pnts data and json file to analyze format specification?
Then, I will decode the sample pnts data using pnts format spec information. (It will help me to make pnts format convertor)

If possible, I would like to see a detailed description of the attribute information type in the pnts file or the codes that generate the pnts file.
such as  magic = "pnts"
         version = 1
         ByteLength = 3440 Byte
         featureTableJSONByteLength = ??? <-  I don't know exact meaning
         featureTableBinaryByteLength = ???
         batchTableJSONByteLength = ???
         batchTableBinaryByteLength = ???

  
We would also appreciate if you can include the text information in the JSON Header Body part.

I will wait for your reply again.

Sean Lilley

unread,
Jun 19, 2017, 7:09:13 PM6/19/17
to cesium-dev

Wonwoo Seo

unread,
Jun 22, 2017, 4:56:52 AM6/22/17
to cesium-dev

Thank you for answer.

 

The information you give me is still being watched.

 

While waiting for an answer, I made a pnts file myself and need to make sure it was created properly.

If there is a problem with the file, please let me know where the problem is.

(I uploaded the pnts file.)

 

I will wait for your reply again.

 



figure1. Pnts file seen in hex



 



figure2. property value in C ++



 

 



figure3. This is my c ++ code

Sample.pnts

Sean Lilley

unread,
Jun 22, 2017, 11:18:58 PM6/22/17
to cesium-dev
The feature table JSON needs to be a JSON string like "{POINTS_LENGTH : 4, POSITION : {byteOffset: 0}}". Otherwise it seems okay at a glance.

Message has been deleted

Wonwoo Seo

unread,
Jun 26, 2017, 4:09:16 AM6/26/17
to cesium-dev

Thanks again for answer.

 

“The string generated from the JSON header should be padded with space characters in order to ensure that the binary body is byte-aligned“

I saw this sentence in Implementation Notes.

 

But, I do not know exactly what it means to consider padding (padded with space characters)

 

Can you give examples or explain in detail?

 

Sean Lilley

unread,
Jun 27, 2017, 8:30:24 PM6/27/17
to cesium-dev
The binary sections of a tile must be byte-aligned, meaning their byte offset within the entire binary should be a multiple of their type. For example, if storing point positions represented as 32-bit floats, that section's byte offset must be divisible by 4.

Wonwoo Seo

unread,
Jul 12, 2017, 4:06:46 AM7/12/17
to cesium-dev


Thank you for your reply every time.



Currently,I am testing with the viewer included in this link.

 ( http://points.chicago.vision/ )






However, the pnts file created by me is not properly displayed in the viewer.

Perhaps there seems to be a problem with pnts.

I'm sorry, but I want you to check for any problems with pnts.



Thank you.

s-0001.pnts

Sean Lilley

unread,
Jul 12, 2017, 8:05:44 PM7/12/17
to cesium-dev
The feature table JSON is not valid JSON. "{POINTS_LENGTH:100,POSITION:{byteOffset:0}}" should instead be "{"POINTS_LENGTH":100,"POSITION":{"byteOffset":0}}.
Message has been deleted

Wonwoo Seo

unread,
Jul 13, 2017, 2:49:24 AM7/13/17
to cesium-dev
Thank you for quick response.


I changed the code as you said, but the same problem occurred.
After checking it, I found that there was a problem with the pnts file itself.
It's probably a problem with the code, but I want to know if the spec I wrote will work just fine. Or should I fill in anything else?

And last time you said there was a bug in the Chicago vision pnts file,
I want to know why the output is normal.
( I will upload the file. )

I'm sorry to have many questions.
Thank you very much.


( This is the point cloud I want  )

Sean Lilley

unread,
Jul 13, 2017, 7:18:15 PM7/13/17
to cesium-dev
With the new JSON string the byte alignment for the feature table binary is now off, that's the main problem I see at the moment.

This is actually good timing because we started working on a validator that should help catch problems like these. Check out our work-in-progress branch here: https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/tree/validator/validator. You can run validation for either the json or the pnts file.

Wonwoo Seo

unread,
Jul 25, 2017, 2:32:54 AM7/25/17
to cesium-dev


Thanks to your many answer, I have completed the pnts file using C++

Thank you very much.


Finally, I want to ask one more thing





As shown above
I want to match the point cloud with the ground, but it does not work well

I'd like you to advise me if I should use the transformation matrix or change the coordinates.

Sean Lilley

unread,
Jul 25, 2017, 8:11:47 PM7/25/17
to cesium-dev
That looks very nice!

The easiest way to match the ground would be to change the coordinates. The transformation is sometimes tricky to get right. Usually the transformation works best if the positions are centered at the origin and axis-aligned to begin with. It's hard to say which approach is best because it often depends on the source data.
Reply all
Reply to author
Forward
0 new messages