<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Create a local scene | Sample | ArcGIS Maps SDK for JavaScript</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.0/"></script>
<arcgis-scene basemap="topo-vector" viewing-mode="local">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
<arcgis-compass slot="top-left"></arcgis-compass>
<arcgis-home slot="top-left"></arcgis-home>
const [FeatureLayer, reactiveUtils] = await $arcgis.import([
"@arcgis/core/layers/FeatureLayer.js",
"@arcgis/core/core/reactiveUtils.js",
"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/HarperSumnerOGWells/FeatureServer/0";
"https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/ks_earthquakes_since_2000/FeatureServer/0";
// The clipping extent for the scene
// autocasts as new Extent()
// autocasts as new SpatialReference()
/********************************************************
* The popupTemplate that will populate the content of the
* popup when a well feature is selected
*******************************************************/
// autocasts as new PopupTemplate()
"<b>API No.:</b> {API_NUMBER}<br>" +
"<b>Lease: </b> {LEASE}<br>" +
"<b>Operator: </b> {CURR_OPERATOR} km<br>" +
"<b>Drilled: </b> {SPUD}<br>" +
"<b>Completed: </b> {COMPLETION}<br>" +
"<b>Status: </b> {STATUS2}<br>" +
"<b>Depth: </b> {DEPTH} meters<br>",
dateFormat: "short-date",
dateFormat: "short-date",
/*********************************************************
* Renderer properties for symbolizing wells on the surface
*********************************************************/
const wellsSurfaceRenderer = {
type: "simple", // autocasts as new SimpleRenderer()
type: "point-3d", // autocasts as new PointSymbol3D()
type: "icon", // autocasts as new IconSymbol3DLayer()
/**************************************************
* Renderer for symbolizing wells below the surface
**************************************************/
const startDate = new Date("Thu Jul 25 2013 00:00:00 GMT-0700 (PDT)");
const endDate = new Date("Mon Nov 09 2015 00:01:40 GMT-0800 (PST)");
const wellsDepthRenderer = {
type: "simple", // autocasts as new SimpleRenderer()
type: "point-3d", // autocasts as new PointSymbol3D()
type: "object", // autocasts as new ObjectSymbol3DLayer()
useSymbolValue: true, // sets the width to 50m
value: startDate.valueOf(),
value: endDate.valueOf(),
/**************************************************
* Layers depicting oil and gas wells in Harper County
* and Sumner County, Kansas
**************************************************/
// Layer for depicting wells below the surface
const wellsLayer = new FeatureLayer({
"Status = 'CBM' OR Status = 'EOR' OR Status = 'GAS' OR Status = 'INJ' OR Status = 'O&G' OR Status = 'OIL' OR Status = 'SWD'",
popupTemplate: wellsTemplate,
renderer: wellsDepthRenderer,
// This keeps the cylinders from poking above the ground
mode: "relative-to-ground",
// Layer for depicting well locations on the surface
const wellsSurfaceLayer = new FeatureLayer({
"Status = 'CBM' OR Status = 'EDR' OR Status = 'GAS' OR Status = 'INJ' OR Status = 'O&G' OR Status = 'OIL' OR Status = 'SWD'",
popupTemplate: wellsTemplate,
renderer: wellsSurfaceRenderer,
/********************************************************
* Renderer for symbolizing earthquakes below the surface
* Earthquakes will be symbolized as spheres. The size of
* each will coincide with the magnitude of the earthquake,
* while the color will indicate the date at which the
* earthquake occured. The more white the color, the older the
* earthquake. The deeper the red, the more recent the
*******************************************************/
type: "simple", // autocasts as new SimpleRenderer()
type: "point-3d", // autocasts as new PointSymbol3D()
type: "object", // autocasts as new ObjectSymbol3DLayer()
value: startDate.valueOf(),
value: endDate.valueOf(),
/********************************************************
* Renderer for symbolizing earthquakes on the surface
*******************************************************/
// Quakes will be symbolized as circles
type: "point-3d", // autocasts as new PointSymbol3D()
type: "icon", // autocasts as new IconSymbol3DLayer()
// Symbol size will vary depending on magnitude of the quake
const quakesSurfaceRenderer = {
type: "simple", // autocasts as new SimpleRenderer()
/********************************************************
* The popupTemplate that will populate the content of the
* popup when an earthquake feature is selected
*******************************************************/
// autocasts as new PopupTemplate()
"<b>Date and time:</b> {date_evt}<br>" +
"<b>Magnitude (0-10): </b> {mag}<br>" +
"<b>Depth: </b> {depth} km<br>",
dateFormat: "short-date-short-time",
className: "esri-icon-notice-round",
/********************************************************
* Create earthquakes layers (one on the surface and one
* below the surface to show actual location).
*******************************************************/
// Defines a layer for drawing the exact location of quakes below the surface
const quakesDepthLayer = new FeatureLayer({
// Show only quakes of magnitude 2.0 or higher
definitionExpression: "mag >= 2",
renderer: quakesRenderer,
popupTemplate: quakeTemplate,
mode: "relative-to-ground",
// Defines a layer for depicting quakes on the surface
const quakesSurfaceLayer = new FeatureLayer({
definitionExpression: "mag >= 2",
renderer: quakesSurfaceRenderer,
popupTemplate: quakeTemplate,
// Get the reference to the Scene component
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
// Fill map with the above defined layers.
viewElement.map.layers = [
// Setting the navigationConstraint on the ground to be of type "none"
// will allow the user to navigate the camera below the surface.
viewElement.map.ground = {
// Use the exent defined in clippingArea to define the bounds of the scene
viewElement.clippingArea = kansasExtent;
viewElement.cameraTilt = 70;
viewElement.extent = kansasExtent;
// Turns off atmosphere and stars settings
viewElement.environment = {
atmosphereEnabled: false,
/********************************************************
* Set up action for returning the number of wells within
* 10km of the earthquake.
*******************************************************/
// Default parameters for selecting wells within 10km of click
const wellsBufferParams = {
spatialRelationship: "esriSpatialRelIntersects",
"Status = 'CBM' OR Status = 'EDR' OR Status = 'GAS' OR Status = 'INJ' OR Status = 'O&G' OR Status = 'OIL' OR Status = 'SWD'",
if (event.action.id === "find-wells") {
wellsBufferParams.geometry = viewElement.popup.selectedFeature.geometry;
.queryFeatureCount(wellsBufferParams)
const results = `<b>${response}</b> active wells are within 10 km of this earthquake.`;
viewElement.popup.content = results;
console.log("action failed: ", error);