How to add Point Cloud

1. A concise explanation of the problem you’re experiencing.

I am beginner with the CesiumJS and I can’t import points to my cesium application as a point cloud

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

viewer.dataSources.add(Cesium.GeoJsonDataSource.load(‘test.geojson’, {

stroke: Cesium.Color.HOTPINK,

fill: Cesium.Color.PINK,

strokeWidth: 3,

markerSymbol: ‘’,

}));

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I tried to work with Geojson data but it returns markers, I want to find the best way to add a point cloud

4. The Cesium version you’re using, your operating system and browser.

1.47, windows,firefox

Have you seen this point cloud Sandcastle example?

Let me know if that helps!

Hi,

Thanks for your help, i’ve been trying to apply this example on my geojson file but the points were not added to the globe. I also tried to use the “Cesium.GeoJsonDataSource.load” method but here i got markers.

Any suggestions are welcomed.

Can you show the code you’re using, or even better, put together a Sandcastle example and share it here?

It’s also possible the camera may not be in the right place. An easy way to set that is:

var tileset = new Cesium.Cesium3DTileset({

url: ‘…/…/…/…/Apps/SampleData/Cesium3DTiles/PointCloud/PointCloudWithPerPointProperties/tileset.json’

});

viewer.scene.primitives.add(tileset);

viewer.zoomTo(tileset, new Cesium.HeadingPitchRange(0.0, -1.0, 50.0));

``

I am using the same example you mentioned, the only difference is the file format (Geojson ). Is the Geojson format valid fot this method or not ? I am not sure.

here is my code
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({

url: ‘test.goejson’, // my file

}));

console.log(tileset);

viewer.scene.primitives.add(tileset);

viewer.zoomTo(tileset, new Cesium.HeadingPitchRange(0.0, -1.0, 50.0));

``

Oh, for a Geojson you have to use Cesium.GeoJsonDataSource.load. See:

And:

https://cesiumjs.org/Cesium/Build/Documentation/GeoJsonDataSource.html

That’s what I did; but this method returns markers instead of simple points which isn’t what i want.

You can try the following which works ok, but recognize that the point is not in exactly the correct location because I’ve just hidden the “flag” portion of the marker.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

sceneMode : Cesium.SceneMode.SCENE2D,

timeline : false,

animation : false

});

var dataSource = Cesium.GeoJsonDataSource.load(’…/…/SampleData/SAR_point.geojson’, {

markerSymbol: 'square',

markerColor: new Cesium.Color(0, 0, 0, 0)

});

viewer.dataSources.add(dataSource);

viewer.zoomTo(dataSource);

``

Here’s the GeoJSON

{

“type”: “FeatureCollection”,

“features”: [

{

“type”: “Feature”,

“geometry”: {

“type”: “Point”,

“coordinates”: [

0.0,

0.0

]

}

}

]

}

``

Scott

Hi,

Thanks a lot Scott, it does solve the problem. Now I have squares instead of markers. Thank you

:slight_smile: