Professional Documents
Culture Documents
Dmitri Bagh
6 min read
With CesiumJS, you can create a web visualization to display your geospatial data in a browser
—making it easy to share your data with anyone, anywhere. Here are the steps I took to
prepare 2D building footprints for a 3D CesiumJS web visualization. Download the
workspace and play with the output below.
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 1/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
dataset with which I would want to make something interesting. This is how I ended up with a
900 MB JSON file representing the buildings of Washington state.
A quick inspection of the footprints revealed there was no elevation information. Perfect! This
looks like a typical task for FME (and for myself) – bring in a few di erent datasets and combine
them into something new and exciting.
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 2/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
From here, FME can take care of everything. As my first steps, I brought the JSON footprints
and rasters into the workspace, extracted building geometries with GeometryExtractor into an
attribute, and using RasterBandCombiner, merged all DSM and DTM into two-band rasters,
grouping them by tile names:
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 3/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 4/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
With RasterBandMinMaxExtractor, I extracted the minimum and maximum values per each
band within each small raster – the lowest pixel value of the DTM band represents the ground,
and the highest value of the DSM band, the top of the roof. To be precise, the highest value is
not guaranteed to be the roof top – it might be a tall tree overhanging the building – but for our
purpose of a massive visualization, it is an acceptable deficiency.
Note DTM and DSM are raster products derived from LiDAR. This means when DEM datasets are
not available, it is possible to use LiDAR data instead – FME will clip the point clouds, and then,
with PointCloudStatisticsCalculator, we can find min and max values within the buildings.
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 5/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 6/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
Today, I can easily share the full result with you thanks to modern web-based technologies. I
hope you enjoyed my three.js experiments before, and now it is time to use the power of
CesiumJS library, which is better suited for geospatial data and can handle huge datasets
thanks to smart tiling and priority settings.
FME currently has two Cesium writers: one for point clouds (Cesium 3D Point Cloud), and
one for 3D geometries such as solids and surfaces (Cesium 3D Tiles).
Writing to 3D Tiles is straightforward. The only format attribute we can set is cesium_priority, a
real number that defines the relative placement of features within the tile hierarchy. I used
VolumeCalculator to set this attribute. In Cesium, this leads to rendering bigger buildings
before smaller ones.
The resulting dataset consists of a JSON file, which outlines the tile structure of the dataset,
and a folder of 3D tiles with the .b3dm extension.
At this point, FME does not generate the HTML file necessary to open the scene in a browser;
however, it can be done with AttributeCreator, where we can easily place the necessary code
with minimal changes, such as specifying paths to the Cesium JavaScript library, CSS style
sheet, and the dataset itself. Of course, it is possible to make any kinds of adjustments and add
a lot more customization and functionality using JavaScript, but for that, I invite you to visit
Cesium.org.
Meanwhile, you can have a look at 1.2 million buildings in King and Pierce counties of
Washington state right in your web browser. A good internet connection and a powerful
computer are recommended 🙂
But if you prefer the old way of sharing, here are a couple of screenshots.
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 7/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
Download and learn how the Cesium workspace is made and try it with your own data. We
would love to hear how you use Cesium tiles in your work or if you don’t use them yet, where
do you see them fit in your organization.
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 8/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
Dmitri Bagh
Dmitri is the scenario creation expert at Safe So ware, which means he spends his
days playing with FME and testing what amazing things it can do.
Comments
3D Tileset Test
@import url(https://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; Dark Mode Beta
}
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 9/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
Reply
Reply
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 10/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment
Related Posts
By utilizing open standards, users can choose best of breed tools for each
application and move data between them with open methods. See where
the OGC fits in to all of this, and learn more about how to use open
standard data yourself....
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 11/12
2021. 3. 19. How to Bring 2D Data into CesiumJS | Safe Software
If you’re reading this, know that you aren’t alone in asking this question. ...
There’s just no resisting the appeal of the hexagon. They have a couple of
significant properties that make them the perfect shape, especially for
mapping....
https://www.safe.com/blog/2018/08/bring-2d-data-cesiumjs/ 12/12