University of Wisconsin, Nov 6, 2018
Powerful 2D/3D visualizations
High-performance client-side analysis
Responsive UI widgets
const map = new Map({
basemap: "topo-vector"
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-118.71511,34.09042],
zoom: 10
});
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
Base class of most of the API.
Consistent pattern:
Single object constructor, no more 3+ constructors
No more property-change events, Use watch()
In 3.x, listen for extent-change event.
In 4.x extent watchers will be called very often
const map = new Map(...);
const view = new MapView({ map: map });
// watch for view scale updates
view.watch('extent', (newValue, oldValue, property, target) => {
console.log(newValue, oldValue, property, target);
})
// 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);
Lab 2 - points, lines, polygons
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
Many different types of layers
https://developers.arcgis.com/javascript/latest/api-reference/index.html
https://developers.arcgis.com/labs/arcgisonline/import-data/
Make the layers public
Do the Find the URL challenge
Using custom content
Using the layer from the previous lab, remove the '/0' from the url:
https://developers.arcgis.com/labs/javascript/add-layers-to-a-map/
Open developer console network tab
Find the feature layer query request. Take a look at service parameters in the REST API doc:
https://developers.arcgis.com/rest/services-reference/feature-service.htm
Powerful visualization tools
https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html
Client-side Geometry engine.
Fast!! No server round-trips needed.
https://developers.arcgis.com/labs/javascript/buffer-and-intersect-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
ArcGIS scripting Engine
Create new values from existing data fields in renderers, popups, labels
https://developers.arcgis.com/javascript/latest/guide/arcade/
Modify this arcade to symbolize trips greater than or less than $6/mile
https://codepen.io/andygup/pen/BwNjMM?editors=1010
Style a vector tile basemap
https://developers.arcgis.com/labs/arcgisonline/style-a-vector-basemap/
When done, go to the item in your ArcGIS Online org and get the root.json URL (hint: View Style button)
Add your new vector map to an app.