The 3D Storytelling solution bridges storytelling and mapping, enabling creators to craft immersive and interactive narratives using Photorealistic 3D Tiles.
-
Explore the hosted admin app to build your first story
-
Download the config once the story is ready
-
Create a fork of this repo and add the downloaded config file as config.json
-
Start the app
This repository consists of two parts. The Storytelling app and an Admin app which adds a control panel to create new stories.
You can build a story configuration using the Admin UI and then you can download the config. The demo app uses this config which is loaded from locally to load the story.
The solution leverages Google maps Platform Photorealistic 3D tiles with Cesium.js as the renderer. Enable all the following APIs:
You need to create a Google API Key and restrict it to at least these APIs.
Also, it is always a good idea to add restrictions for specific websites (i.e. localhost:5500
for local development).
- Download or
git clone
this repository - Extract the contents of the
src
folder - Adjust the
config.json
to your needs - see Configuration - Add your Google Maps Platform API key to env.exmaple.js and rename the file to
env.js
- Serve the files with a static webserver
- Clone this repo to your local machine:
git clone ...
- Run the admin setup script:
cd js-3d-area-explorer && chmod +x build_admin.sh
- Start the server:
./build_admin.sh <YOUR_GMP_API_KEY>
- Note: The script can pick up the API_KEY from envrionment variable
API_KEY
as well. - Note: The script can also be started as
./build_admin.sh <PORT> <YOUR_GMP_API_KEY>
. By default it starts at port 5500.
- Note: The script can pick up the API_KEY from envrionment variable
You can use your own local webserver to show the 3D Area Explorer app like this:
- From the root directory:
npx http-server -p 5500 ./src
For the local development you still need the API key for 3D Map Tiles and Google Places/Maps requests.
You need to have docker installed to best work with the demo-app locally.
- Clone the repository
docker-compose build demo
docker-compose up demo
There is a second docker compose service docker-compose up app
which only serves the admin app. For this you may need to update the config.json
file to include you data.
Note: You should follow these instructions if you want to create your own admin app in a different language other than bash.
To start the local server as admin app do the following:
- Copy the files in demo/src to demo/
- Bash command from
/demo
directory:cp -r ../demo/src ./demo
- Bash command from
- In index.html, at the end of the file, it has reference to main.js. Change it to demo/sidebar.js.
- Bash command from
/src
directory:sed -i'.bak' "s/main.js/demo\/sidebar.js/g" index.html
- Bash command from
- Start the node app by running npx
- Bash commpand from
src
directory:http-server -p 5500 ./src
- Bash commpand from
You can edit the config.json
file in the src
directory to change settings. It is also possible to implement your own loadConfig
function to get configuration from a different file on a different server or to request an API which dynamically returns configuration.
The SampleConfig folder contains a few pre built configurations.
The properties
object in the config.json
is responsible for the overall story settings. Here you can set the hero image, title, date, description and inital camera position of the story as a whole.
The chapters
property of the config object holds an array of all the story chapters. For each chapter there are different options to set. For example the cahpter title image/video url geo-coordinates and other content. Additionaly you can adjust the camera position and heading (cameraOptions
), and how to focus the chapter location on the globe (focusOptions
).
The camera object in the story and chapter properties. The location, where the camera is positioned in the 3D space is configured in the position
object. The orientation, what the camera is looking at, is set via heading
, pitch
and roll
.
Most of the cesium setting are located and documented in /src/utils/cesium.js
.
Here are some highlights:
RADIUS: The radius from the target point to position the camera. BASE_PITCH_RADIANS: The base pitch of the camera. Defaults to -30 degrees in radians. BASE_HEADING_RADIANS: The base heading of the camera. Defaults to 180 degrees in radians. DEFAULT_HIGHLIGHT_RADIUS: The default radius size of the highlighted area.
For the local development you still need the API key for 3D Map Tiles and Google Places/Maps requests.
To deploy the 3D Story telling app you need to upload everything in the src
folder to a static web server or some other hosting service. A static web server is enough. You need a domain for you webspace, though. Since the Google Maps API key is only restricted on a domain you would risk misuse of the key.
Included in the repository is a Dockerfile
which can be used to build a docker image. This can be used to deploy with Google Cloud Run or other container cloud services.
The repositiory is structured to have separate folder for the demo app (/src
) and the
demo/configuration-ui (/demo/src
). This is due to fact that we need to deploy different versions.
The app part of the repository is self contained and can be used as is (after updating the configuration). This will show the globe with 3D tiles. Centered on the location
setting in config.json
. It will be filled with places from the Google Places API (configured in config.json
).
The demo folder contains additional code to render an Admin UI to which helps build a story configuration for config.json
. The code is added to the deployment by running the /demo/Dockerfile
.
This solution uses Google Maps Platform services. Use of Google Maps Platform services through this solution is subject to the Google Maps Platform Terms of Service.
This solution is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this solution.
This solution is offered via an open source license. It is not governed by the Google Maps Platform Support Technical Support Services Guidelines, the SLA, or the Deprecation Policy (however, any Google Maps Platform services used by the solution remain subject to the Google Maps Platform Terms of Service).
If you find a bug, or have a feature request, please file an issue on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our developer community channels. If you'd like to contribute, please check the Contributing guide.
You can also discuss this solution on our Discord server.