Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
arcgis-jsapi-snippets
Advanced tools
Code snippets for the ArcGIS API for JavaScript for 2D and 3D mapping and visualization.
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.
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:
"editor.tabCompletion": "on"
in the settings (Preferences
> Open Settings(JSON)
)Ctrl-Space
(Cmd-Space
on mac) to select the one you need.Read more about this feature in the official VSCode documentation.
Prefix | Description |
---|---|
getApi | Add the css and javascript for the Esri ArcGIS API for JavaScript from the CDN. This snippet also stubs out the package paths. |
Prefix | Description |
---|---|
require | Load the Map and MapView modules using require |
map | Create a map and view. Contains placeholders for the basemap, container, zoom and center |
scene | Create a scene and view. Contains placeholders to replace the basemap and the container value. |
webmap | Create a map from a WebMap. Contains a placeholder for the portal item id and for the container. |
webscene | Create a 3D map from a WebScene. Contains a placeholder for the portal item id and for the container. |
addLayerFromPortalItem | Add a new layer to the map using a portal item id. Contains a placeholder for the portal item id. |
simple | Generate a simple renderer. Contains a placeholder for the symbol. |
uniqueValue | Generate 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. |
classBreaks | Generate 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. |
sizeVar | Creates 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. |
colorVar | Creates a ColorVariable with 2 color stops. It contains placeholders for field, normalizationField, the legend title and the color stop values. |
labeling2d | Creates the labelingInfo for labels in a MapView. |
labeling3d | Creates the labelingInfo for labels in a SceneView. |
icon | Creates a PointSymbol3D with IconSymbol3DLayer in a SceneView. Contains placeholders for primitive, color and size.. |
line | Creates a LineSymbol3D with a LineSymbol3DLayer in a SceneView. Contains placeholders for color and size. |
path | Creates a LineSymbol3D with a PathSymbol3DLayer in a SceneView. Contains placeholders for profile, color, width, height, join, cap, anchor and profileRotation. |
fill | Creates a PolygonSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholders for material color and outline color. |
extrude | Creates a PolygonSymbol3D with an ExtrudeSymbol3DLayer in a SceneView. Contains placeholders for material color and size. |
mesh | Creates a MeshSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholder for color. |
edges | Creates 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. |
calloutSmall | Generates 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. |
calloutLarge | Generates 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. |
elevationInfo | Creates an object for elevationInfo to be set on layers. Contains placeholders for mode, offset, arcade driven expression and unit. |
background | Creates an environment object for changing the background of a scene. It should be set on a SceneView and it contains a placeholder for color. |
Prefix | Description |
---|---|
map | Import the map and map view modules then create a new Map and MapView. Contains placeholders for basemap, center and zoom. |
scene | Import the map and scene view modules then create a new Scene and Scene view. Contains a placeholder for the basemap |
webmap | Import 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. |
webscene | Import 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. |
addLayerFromPortalItem | Add a new layer to the map from an ArcGIS Online or Enterprise portal item. Contains a placeholder for the portal item id. |
simple | Generates a SimpleRenderer. Contains a placeholder for the symbol. |
uniqueValue | Generates 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. |
classBreaks | Generates 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. |
sizeVar | Creates 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. |
colorVar | Creates a ColorVariable with 2 color stops. It contains placeholders for field, normalizationField, the legend title and the color stop values. |
labeling2d | Creates the labelingInfo for labels in a MapView. |
labeling3d | Creates the labelingInfo for labels in a SceneView. |
icon | Creates a PointSymbol3D with IconSymbol3DLayer in a SceneView. Contains placeholders for primitive, color and size. |
object | Creates a PointSymbol3D with ObjectSymbol3DLayer in a SceneView. Contains placeholders for primitive, color, height, depth and width. |
line | Creates a LineSymbol3D with a LineSymbol3DLayer in a SceneView. Contains placeholders for color and size. |
path | Creates a LineSymbol3D with a PathSymbol3DLayer in a SceneView. Contains placeholders for profile, color, width, height, join, cap, anchor and profileRotation. |
fill | Creates a PolygonSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholders for material color and outline color. |
extrude | Creates a PolygonSymbol3D with an ExtrudeSymbol3DLayer in a SceneView. Contains placeholders for material color and size. |
mesh | Creates a MeshSymbol3D with a FillSymbol3DLayer in a SceneView. Contains placeholder for color. |
sketchEdges | Creates SketchEdges3D that can be applied to a FillSymbol3DLayer. Contains placeholders for the color, the size and the extensionLength. |
soildEdges | Creates SolidEdges3D that can be applied to a FillSymbol3DLayer. Contains placeholders for the color and the size. |
calloutSmall | Generates 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. |
calloutLarge | Generates 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. |
elevationInfo | Creates an object for elevationInfo to be set on layers. Contains placeholders for mode, offset, arcade driven expression and unit. |
background | Creates an environment object for changing the background of a scene. It should be set on a SceneView and it contains a placeholder for color. |
Prefix | Description |
---|---|
tsconfig | Default tsconfig file |
tsconfigBasic | Simple tsconfig file |
Prefix | Description |
---|---|
widgetStarter | Basic starter for creating an esri widget. Contains placeholders for the widget name and default css class name. |
renderableProperty | Add a renderable property. Contains placeholder for the property name. |
constructor | Add a constructor |
Initial release of the ArcGIS API for JavaScript snippet extension.
Find a bug or want to request a new feature? Please let us know by submitting an issue.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
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/.
FAQs
Code snippets for the ArcGIS API for JavaScript for 2D and 3D mapping and visualization.
We found that arcgis-jsapi-snippets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.