Socket
Socket
Sign inDemoInstall

arcgis-jsapi-snippets

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    arcgis-jsapi-snippets

Code snippets for the ArcGIS API for JavaScript for 2D and 3D mapping and visualization.


Version published
Weekly downloads
9
increased by800%
Maintainers
1
Install size
1.60 MB
Created
Weekly downloads
 

Changelog

Source

[Version 1.1.1]

  • Add latest versions to the getAPI snippet
  • Fix typo in package.json
  • Update tsconfig snippet to include importHelpers and moduleResolution

Readme

Source

arcgis-jsapi-snippets README

Collection of VSCode snippets for common code patterns with ArcGIS API for JavaScript and a VSCode extension (in the extension folder) that you can view in VSCode marketplace.

How to use it

To install this extension you need to have VSCode version 1.35 or higher.

After installing type in the prefix for the code snippet followed by the Tab key:

example

  • make sure to have "editor.tabCompletion": "on" in the settings (Preferences > Open Settings(JSON))
  • if pressing Tab doesn't work then you might have several snippets with the same prefix. Press Ctrl-Space (Cmd-Space on mac) to select the one you need.

Read more about this feature in the official VSCode documentation.

Features

HTML snippets

PrefixDescription
getApiAdd the css and javascript for the Esri ArcGIS API for JavaScript from the CDN. This snippet also stubs out the package paths.

JavaScript snippets

PrefixDescription
requireLoad the Map and MapView modules using require
mapCreate a map and view. Contains placeholders for the basemap, container, zoom and center
sceneCreate a scene and view. Contains placeholders to replace the basemap and the container value.
webmapCreate a map from a WebMap. Contains a placeholder for the portal item id and for the container.
websceneCreate a 3D map from a WebScene. Contains a placeholder for the portal item id and for the container.
addLayerFromPortalItemAdd a new layer to the map using a portal item id. Contains a placeholder for the portal item id.
simpleGenerate a simple renderer. Contains a placeholder for the symbol.
uniqueValueGenerate a unique value renderer. Contains a placeholder for the field, the symbol and it generates a uniqueValueInfos array with placeholers for value, symbol and label for the legend.
classBreaksGenerate a class breaks renderer. Contains a placeholder for the field, the default symbol and it generates a classBreakInfos array with placeholers for minValue, maxValue, symbol and label for the legend.
sizeVarCreates a SizeVariable with 2 size stops. The axis property is only used in 3D. It contains placeholders for field, normalizationField, the legend title and the size stop values.
colorVarCreates a ColorVariable with 2 color stops. It contains placeholders for field, normalizationField, the legend title and the color stop values.
labeling2dCreates the labelingInfo for labels in a MapView.
labeling3dCreates the labelingInfo for labels in a SceneView.
iconCreates a PointSymbol3D with IconSymbol3DLayer in a SceneView. Contains placeholders for primitive, color and size..
lineCreates a LineSymbol3D with a LineSymbol3DLayer in a SceneView. Contains placeholders for color and size.
pathCreates a LineSymbol3D with a PathSymbol3DLayer in a SceneView. Contains placeholders for profile, color, width, height, join, cap, anchor and profileRotation.
fillCreates a PolygonSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholders for material color and outline color.
extrudeCreates a PolygonSymbol3D with an ExtrudeSymbol3DLayer in a SceneView. Contains placeholders for material color and size.
meshCreates a MeshSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholder for color.
edgesCreates an edges object that can be applied to a FillSymbol3DLayer. Contains placeholders for the type of edges (solid or sketch), the color, the size and the extensionLength.
calloutSmallGenerates the verticalOffset for a city scale level and the callout property. They should be set on PointSymbol3D or LabelSymbol3D. Contains placeholders for size, color and border color.
calloutLargeGenerates the verticalOffset for a globe scale level and the callout property. They should be set on PointSymbol3D or LabelSymbol3D. Contains placeholders for size, color and border color.
elevationInfoCreates an object for elevationInfo to be set on layers. Contains placeholders for mode, offset, arcade driven expression and unit.
backgroundCreates an environment object for changing the background of a scene. It should be set on a SceneView and it contains a placeholder for color.

TypeScript snippets

PrefixDescription
mapImport the map and map view modules then create a new Map and MapView. Contains placeholders for basemap, center and zoom.
sceneImport the map and scene view modules then create a new Scene and Scene view. Contains a placeholder for the basemap
webmapImport the WebMap and MapView modules and create a new MapView from a web map id. Contains a placeholder for the web map id and map container.
websceneImport the WebScene and SceneView modules and create a new SceneView from a portal item id. Contains a placeholder for the item id and map container.
addLayerFromPortalItemAdd a new layer to the map from an ArcGIS Online or Enterprise portal item. Contains a placeholder for the portal item id.
simpleGenerates a SimpleRenderer. Contains a placeholder for the symbol.
uniqueValueGenerates a UniqueValueRenderer. Contains a placeholder for the field, the symbol and it generates a uniqueValueInfos array with placeholers for value, symbol and label for the legend.
classBreaksGenerates a ClassBreaksRenderer. Contains a placeholder for the field, the default symbol and it generates a classBreakInfos array with placeholers for minValue, maxValue, symbol and label for the legend.
sizeVarCreates a SizeVariable with 2 size stops. The axis property is only used in 3D. It contains placeholders for field, normalizationField, the legend title and the size stop values.
colorVarCreates a ColorVariable with 2 color stops. It contains placeholders for field, normalizationField, the legend title and the color stop values.
labeling2dCreates the labelingInfo for labels in a MapView.
labeling3dCreates the labelingInfo for labels in a SceneView.
iconCreates a PointSymbol3D with IconSymbol3DLayer in a SceneView. Contains placeholders for primitive, color and size.
objectCreates a PointSymbol3D with ObjectSymbol3DLayer in a SceneView. Contains placeholders for primitive, color, height, depth and width.
lineCreates a LineSymbol3D with a LineSymbol3DLayer in a SceneView. Contains placeholders for color and size.
pathCreates a LineSymbol3D with a PathSymbol3DLayer in a SceneView. Contains placeholders for profile, color, width, height, join, cap, anchor and profileRotation.
fillCreates a PolygonSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholders for material color and outline color.
extrudeCreates a PolygonSymbol3D with an ExtrudeSymbol3DLayer in a SceneView. Contains placeholders for material color and size.
meshCreates a MeshSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholder for color.
sketchEdgesCreates SketchEdges3D that can be applied to a FillSymbol3DLayer. Contains placeholders for the color, the size and the extensionLength.
soildEdgesCreates SolidEdges3D that can be applied to a FillSymbol3DLayer. Contains placeholders for the color and the size.
calloutSmallGenerates the verticalOffset for a city scale level and the callout property. They should be set on PointSymbol3D or LabelSymbol3D. Contains placeholders for size, color and border color.
calloutLargeGenerates the verticalOffset for a globe scale level and the callout property. They should be set on PointSymbol3D or LabelSymbol3D. Contains placeholders for size, color and border color.
elevationInfoCreates an object for elevationInfo to be set on layers. Contains placeholders for mode, offset, arcade driven expression and unit.
backgroundCreates an environment object for changing the background of a scene. It should be set on a SceneView and it contains a placeholder for color.

JSON snippets

PrefixDescription
tsconfigDefault tsconfig file
tsconfigBasicSimple tsconfig file

TSX snippets

PrefixDescription
widgetStarterBasic starter for creating an esri widget. Contains placeholders for the widget name and default css class name.
renderablePropertyAdd a renderable property. Contains placeholder for the property name.
constructorAdd a constructor

Release Notes

1.0.0

Initial release of the ArcGIS API for JavaScript snippet extension.

Instructions

  • Visual Studio Code marketplace
  • Install the extension using the Install from VSIX command in Visual Studio Code then import the arcgis-jsapi-snippets-1.0.0.vsix file.
  • Or copy/paste the snippets you want to use into the appropriate snippet file. To open the snippet files in Visual Studio Code select User Snippets under File > Preferences (Code > Preferences on macOS) and select the language**

Requirements

  • Visual Studio Code

Resources

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

The snippets are 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.

Information on the ArcGIS API for JavaScript licensing can be found here: https://developers.arcgis.com/javascript/latest/guide/licensing/.

Keywords

FAQs

Last updated on 27 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc