for (var longitude = -180; longitude < 180; longitude++) {
var color = Cesium.Color.PINK;
if ((longitude % 2) === 0) {
color = Cesium.Color.CYAN;
}
for (var latitude = -90; latitude < 90; latitude++) {
points.add({
position : Cesium.Cartesian3.fromDegrees(longitude, latitude),
color : color,
heightReference : Cesium.HeightReference.RELATIVE_TO_GROUND
});
}
I have many many points ([x,y,z,value] data). I would like to use “point cloud” technology, but I don’t know how to make point cloud from these data simply, not using .las files and similar exotic compexities. I thought using PointPrimitiveCollection I will gain better performance then separately adding points.
If you want to get a custom point cloud like that in CesiumJS the easiest way may be to generate a LAS file. I’ve found tools like LASPy useful for this: https://pythonhosted.org/laspy/. It should be straightforward if you can export your XYZ values from Java as a CSV file, and have a few lines of Python code turn that into an LAS that you can upload to Cesium ion.
That still doesn’t solve the clamp to ground issue though - as far as I’m aware most use cases for point clouds need to maintain the position of each point, so you’d lose that information if you clamp to ground. But if you did need to do this with primitives you’d have to look at how the Entity API does it (which queries the terrain height at each point) and moves the position accordingly (but at that point you might as well use the Entity API).