Hands-on Workshop
GIS in the Rockies - Sep 18, 2018
agup@esri.com
github.com/andygup
@agup
wreynolds@esri.com
Build some fun mapping apps
Labs + Discussions
Intro to basic concepts of the ArcGIS API for JavaScript 4.x
Hello World Map
Add a layer
Create a layer from scratch
Style a layer
Add point, line and polygon
Configure popup Part 1
Configure popup Part 2
Create a WebMap in ArcGIS Online
Add WebMap to custom app
Style your basemap
Style a feature layer
Add popups in WebMap
1. Go to DevLabs -https://developers.arcgis.com/labs/
2. Go to JavaScript =>
Try out the Challenges at the bottom of the Lab.
Open the developer console network tab and reload app
Try out the Challenges at the bottom of the Lab.
Compare the amount of data returned in the Filter Features Challenge
Take a look at service parameters in the REST API doc
https://developers.arcgis.com/rest/services-reference/feature-service.htm
Geometries
Symbols
Graphics
Renderers
// Geometry
var polyline = {
type: "polyline",
paths: [
[-111.30, 52.68],
[-98, 49.5],
[-93.94, 29.89]
]
};
// Symbol
var polylineSymbol = {
type: "simple-line",
color: [226, 119, 40],
width: 4
};
// Graphic
var polylineGraphic = new Graphic({
geometry: polyline,
symbol: polylineSymbol
});
view.graphics.add(polylineGraphic);
Geometries, symbols and graphics
var highwayRenderer = {
type: "simple",
symbol: {
type: "simple-line",
color: [226, 119, 40],
width: 4
}
};
Simple Renderer
Skip the Challenges at the bottom
Skip the Challenges at the bottom of the Lab. We have a separate lab coming up.
API Reference: esri/geometry/Geometry
https://codepen.io/andygup/pen/bveoKE?editors=1000
Objective: add code to dock the popup
Hint: Use dockEnabled and dockOptions
Feature Layers have built-in popups
You can also manually configure popups
Popups can be docked
Use the appID from Lab 8 to create a custom app
Using AGOL webmap uses considerably less code
You can wrap other custom elements and styling around the web map.
https://developers.arcgis.com/labs/arcgisonline/style-a-vector-basemap/
Objective: use the basemap in a custom app.
Use cases for styling your own maps?
https://developers.arcgis.com/labs/javascript/add-layers-to-a-map/
Objective: Import the featurelayer into a custom app.
User interface based
Faster and less code than building renderers by hand.
https://developers.arcgis.com/labs/arcgisonline/configure-pop-ups/
Objective: import the webmap into custom app
Faster and easier than writing custom code
Popups get inherited with webmap
Layers
Geometries
Visualization tools - renderers, symbols, arcade
Client-side geometry engine
Widgets
Tasks
Authentication
And much more!