Monthly Archives: September 2015

Cesiumjs – How to draw a polyline from one height to the next.

phpmind-cesiumjs-draw-poly-lines

Share

Cesiumjs – How to draw line slowly and stop on left click.

phpmind-cesiumjs-create-lines-slowely-1

phpmind-cesiumjs-create-lines-slowely

Share

Cesiumjs – Hooks buttons or any other control into the Cesium Viewer toolbar.

phpmind-cesiumjs-create-html-controls

Hooks buttons or any other control into the Cesium Viewer toolbar.

Share

Cesiumjs – How to set default imagery provider.

phpmind-cesiumjs-set-default-image-layer

If you want to use the BaseLayerPicker, then you need to specify what imagery and terrain seletions are available. It’s more code bu just as straight forward. Here’s a full example that adds two possible terrains and 2 possible imagery providers. It makes the second one active by default by setting the selectedXXX properties, otherwise the first index would be active instead.

Share

cesiumjs – How to flies to an entity and create marker.

phpmind-cesiumjs-fly-to-entity
Flies to an entity (marker) then tracks it without the camera jumping

phpmind-cesiumjs-fly-to-entity-1000-above
How to zoom in about 1000 meters above it ?
I would like to now get the position of the entity (used in the onTick), and then pass this to the camera, lookAt function.

entity.position() provides me info, but I am not sure how I can use this to pass it to the lookAt function.

The first argument is the pin position. The second argument is a Cartesian3 offset in the pin’s reference frame, so z=1000 puts the camera 1000m above the pin.

Share

cesiumjs – How to access folder from KML file and parse.

How to access from KML file and parse to make folder structure.
phpmind-cesiumjs-access-folder-from-kml

KML file

Share

Cesiumjs – How to access the coordinates

phpmind-cesiumjs-access-the-coordinates

Those coordinates are given in radians. You can convert them back to degrees with Cesium.Math.toDegrees(radianValue).

Share

Cesiumjs – Show and hide multiple entity/labels

How can i toggle multiple labels/entities ?

phpmind-cesiumjs-show-hide

Share

cesiumjs – How to Make Multicolor Polyline

How does segmenting a polyline into different colors work.

Cesiumjs-Multicolor-Polyline

Share

How to enable cross-origin resource sharing using php

I was working on parsing KML data file from different resources which had different urls and Cesiumjs was unable to read/parse, that is how i come to know enabling cross-origin resource sharing.
It is also called CORS. Here is more details .

Following these steps you can enable “CORS”.
1. First check if you have apache module installed, using php.

2. Use command line to check if you have “Access-Control-Allow-Origin: *”

3. If you don’t see this line “Access-Control-Allow-Origin: *” in curl -I output you need to add and enable it in either in PHP file ot .htacces file.

4. Now its time to add code and enable your missing part!

In .htaccess

In PHP file

After that you need to test using

You must see Access-Control-Allow-Origin: *” with headers.

Share