How to add Point Cloud

467 views
Skip to first unread message

DW

unread,
Aug 2, 2018, 9:46:57 AM8/2/18
to cesium-dev
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

Omar Shehata

unread,
Aug 2, 2018, 10:18:23 AM8/2/18
to cesium-dev
Have you seen this point cloud Sandcastle example?

DW

unread,
Aug 2, 2018, 10:43:58 AM8/2/18
to cesium-dev
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.

Omar Shehata

unread,
Aug 2, 2018, 11:24:06 AM8/2/18
to cesium-dev
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));
Message has been deleted

DW

unread,
Aug 2, 2018, 11:33:36 AM8/2/18
to cesium-dev
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);

Omar Shehata

unread,
Aug 2, 2018, 11:37:03 AM8/2/18
to cesium-dev

DW

unread,
Aug 2, 2018, 11:41:39 AM8/2/18
to cesium-dev
That's what I did; but this method returns markers instead of simple points which isn't what i want. 

Scott Reynolds

unread,
Aug 3, 2018, 9:00:23 AM8/3/18
to cesium-dev
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

DW

unread,
Aug 3, 2018, 9:26:20 AM8/3/18
to cesium-dev
Hi,

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

:)
Reply all
Reply to author
Forward
0 new messages