npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-sceneview

v0.2.26

Published

react-sceneview

Downloads

30

Readme

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

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | id | string | | Unique id of this sceneview. This id is used to handle hot module reloading and other component refreshes. | | environment | object | | Environment parameters of the sceneview. | | goTo       | object | | Sets the view to a given target camera or geometry. | | onClick | function | | Callback fired after a click in the SceneView. Returns hit test results. | | onMouseMove | function | | Callback fired after a mouse move (hover) in the SceneView. Returns hit test results. | | onCameraChange | function | | A callback fired after the camera has been changed. Returns the new camera object. |

Scene

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | basemap | string | gray-vector | Specifies 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']. | | ground | string | world-elevation | Specifies the surface properties for the map. | | initialViewProperties | object | | This object contains properties such as viewpoint, spatialReference, viewingMode, and environment that should be applied to the SceneView when the scene loads. |

Layer

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | id | string | | Unique id used to reference the layer. | | url | string | | URL of scene or feature layer. If omitted, a layer source is required. | | visible       | bool | true | Indicates if the layer is visible in the SceneView. | | selectable | bool | false | Indicates if features on this layer are returned in onClick and onMouseMove events, as well as from the selection tools. | | highlight | array | [] | Feature object ids to be highlighted (usually selection). | | definitionExpression | string | | The SQL where clause used to filter features on the client. | | renderer | object | | The renderer assigned to the layer, supplied as an Auto-casting object. | | rendererJson | object | | The renderer assigned to the layer, supplied as a JSON object generated from a product in the ArcGIS platform. | | labelingInfo | object | | The label definition for this layer, specified as an array of LabelClass. | | labelsVisible | bool | false | Indicates whether to display labels for this layer. | | refresh | number | | Change value to refresh the layer. | | outFields | array | | Attribute fields which will be exposed (e.g., through selection callbacks). |

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

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | geometryType | string | | Geometry type when using client-side graphics. | | fields | array | | Attribute fields when using client-side graphics. | | objectIdField | string | | Object id field when using client-side graphics.|

Graphic

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | geometry | object | | The geometry that defines the graphic's location. | | attributes | array | | Name-value pairs of fields and field values associated with the graphic. | | symbol | object | | The Symbol for the graphic. |

CustomBasemap

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | portalItem | object | | The portal item (WebMap or WebScene) containing the custom base map. |

CustomElevationLayer

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | url | string | | URL pointing to the Elevation layer resource on an ArcGIS Image Server. |

UI.Zoom, UI.Compass, UI.NavigationToggle

| Name | Type | Default | Description | | :------------ | :------------- | :------ | :---------- | | position | string | | Position 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.