0.2.26 • Published 3 years ago

react-sceneview v0.2.26

Weekly downloads
100
License
Apache License - ...
Repository
-
Last release
3 years ago

react-sceneview

A simple Esri SceneView react component that builds on the ArcGIS API for JavaScript.

Table of Contents

Installing

$ npm install --save react-sceneview

Then, just import to your React component:

import { SceneView, Scene } from 'react-sceneview';

Examples

import React from 'react';
import { render } from 'react-dom';
import { SceneView, Scene, Webscene } from 'react-sceneview';

render(
  <SceneView id="sceneview">
    <Scene>
      <Webscene  portalItem={{ id: '34859cee6739438d93262a5aa91bf834' }} />
    </Scene>
  </SceneView>,
  document.getElementById('root'),
);

Add a WebScene and/or individual layers:

<SceneView id="sceneview">
  <Scene>
    <Layer id="buildings" layerType="scene" url={SCENE_LAYER_URL} />
    <Layer id="districts" layerType="feature" url={FEATURE_LAYER_URL} />
  </Scene>
</SceneView>

Supports various features such as UI widgets, custom basemaps, selection, highlights, definitionExpression, etc...

<SceneView id="sceneview" onClick={handleSelect}>
  <UI.Zoom position="top-left" />
  <Scene>
    <CustomBasemap portalItem={{ id: 'ae53cf192181425ab999e8a19e41a6dc' }} />
    <Layer id="1" url={URL1} layerType="scene" selectable highlight={selection} />
    <Layer id="2" url={URL2} layerType="feature" definitionExpression="Scenario IN (1,2)" />
    <Layer id="3" url={URL3} layerType="feature" visible={false} />
  </Scene>
</SceneView>

Dynamically add and remove layers:

  <SceneView
    id="sceneview"
  >
    <Scene>
      {layers.map(({ layerId, ...layerSettings }) => (
        <Layer
          key={layerId}
          id={layerId}
          {...layerSettings}
        />
      ))}
    </Scene>
  </SceneView>

Supports client-side graphics: dynamically add and remove graphics from feature layer.

<SceneView id="sceneview">
  <Scene>
    <Layer
      id="points"
      layerType="feature"
      geometryType="polygon"
      fields={fields}
      objectIdField="OID"
    >
      {graphics.map(graphic => (
        <Graphic geometry={graphic.geometry} attributes={graphic.attributes} symbol={graphic.symbol} />
      )}
    </Layer>
  </Scene>
  <DrawingTool onDraw={handleDrawUpdate} />
</SceneView>

Props

SceneView

NameTypeDefaultDescription
idstringUnique id of this sceneview. This id is used to handle hot module reloading and other component refreshes.
environmentobjectEnvironment parameters of the sceneview.
goTo      objectSets the view to a given target camera or geometry.
onClickfunctionCallback fired after a click in the SceneView. Returns hit test results.
onMouseMovefunctionCallback fired after a mouse move (hover) in the SceneView. Returns hit test results.
onCameraChangefunctionA callback fired after the camera has been changed. Returns the new camera object.

Scene

NameTypeDefaultDescription
basemapstringgray-vectorSpecifies a basemap for the map. One of ['streets', 'satellite', 'hybrid', 'topo', 'gray', 'dark-gray', 'oceans', 'national-geographic', 'terrain', 'osm', 'dark-gray-vector', 'gray-vector', 'streets-vector', 'topo-vector', 'streets-night-vector', 'streets-relief-vector', 'streets-navigation-vector'].
groundstringworld-elevationSpecifies the surface properties for the map.
initialViewPropertiesobjectThis object contains properties such as viewpoint, spatialReference, viewingMode, and environment that should be applied to the SceneView when the scene loads.

Layer

NameTypeDefaultDescription
idstringUnique id used to reference the layer.
urlstringURL of scene or feature layer. If omitted, a layer source is required.
visible      booltrueIndicates if the layer is visible in the SceneView.
selectableboolfalseIndicates if features on this layer are returned in onClick and onMouseMove events, as well as from the selection tools.
highlightarray[]Feature object ids to be highlighted (usually selection).
definitionExpressionstringThe SQL where clause used to filter features on the client.
rendererobjectThe renderer assigned to the layer, supplied as an Auto-casting object.
rendererJsonobjectThe renderer assigned to the layer, supplied as a JSON object generated from a product in the ArcGIS platform.
labelingInfoobjectThe label definition for this layer, specified as an array of LabelClass.
labelsVisibleboolfalseIndicates whether to display labels for this layer.
refreshnumberChange value to refresh the layer.
outFieldsarrayAttribute fields which will be exposed (e.g., through selection callbacks).

If using client-side graphics, the following props are required:

NameTypeDefaultDescription
geometryTypestringGeometry type when using client-side graphics.
fieldsarrayAttribute fields when using client-side graphics.
objectIdFieldstringObject id field when using client-side graphics.

Graphic

NameTypeDefaultDescription
geometryobjectThe geometry that defines the graphic's location.
attributesarrayName-value pairs of fields and field values associated with the graphic.
symbolobjectThe Symbol for the graphic.

CustomBasemap

NameTypeDefaultDescription
portalItemobjectThe portal item (WebMap or WebScene) containing the custom base map.

CustomElevationLayer

NameTypeDefaultDescription
urlstringURL pointing to the Elevation layer resource on an ArcGIS Image Server.

UI.Zoom, UI.Compass, UI.NavigationToggle

NameTypeDefaultDescription
positionstringPosition of the UI widget. One of ['top-left', 'top-right', 'bottom-right', 'bottom-left']. Default is 'top-left'.

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2019 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

0.2.26

3 years ago

0.2.25

3 years ago

0.2.24

3 years ago

0.2.23

3 years ago

0.2.22

3 years ago

0.2.21

3 years ago

0.2.20

3 years ago

0.2.19

4 years ago

0.2.18

4 years ago

0.2.17

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.7

4 years ago

0.2.8

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.75

5 years ago

0.1.74

5 years ago

0.1.73

5 years ago

0.1.72

5 years ago

0.1.71

5 years ago

0.1.70

5 years ago

0.1.69

5 years ago

0.1.68

5 years ago

0.1.67

5 years ago

0.1.66

5 years ago

0.1.65

5 years ago

0.1.64

5 years ago

0.1.63

5 years ago

0.1.62

5 years ago

0.1.61

5 years ago

0.1.60

5 years ago

0.1.59

5 years ago

0.1.58

5 years ago

0.1.57

5 years ago

0.1.56

5 years ago

0.1.55

5 years ago

0.1.54

5 years ago

0.1.53

5 years ago

0.1.52

5 years ago

0.1.51

5 years ago

0.1.50

5 years ago

0.1.49

5 years ago

0.1.48

5 years ago

0.1.47

5 years ago

0.1.46

5 years ago

0.1.45

5 years ago

0.1.44

5 years ago

0.1.43

5 years ago

0.1.42

5 years ago

0.1.41

5 years ago

0.1.40

5 years ago

0.1.39

5 years ago

0.1.38

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.35

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago

0.1.24

5 years ago

0.1.23

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago