Item page
CodePen
Sandbox Download

The distribution of American Indian, Alaska Native, and Native Hawaiian (AIANNH) areas in the United States are shown using opaque, unicolored polygons.

What is the location style?

The location style involves styling all features in a layer with a single symbol. This is designed to only visualize the location of features with no other data-driven attributes overriding the symbol. Location, or geometry, is the only way to distinguish one feature from another. This allows you to treat all the features equally and let their spatial pattern speak for itself on the map.

How to style features by location

In general, there are two ways to style features A feature is a single record, also known as a row, that represents a real-world entity. It typically contains a geometry (point, multipoint, polyline, or polygon) and attributes but it can also contain just attributes. Learn more :

  1. Apply symbols to graphics: Use this approach when you need to display the location for temporary graphics A graphic is a visual element composed of a geometry, symbol, and attributes that is displayed on a map or scene. Learn more in a map A map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. Learn more or scene A scene is a collection of layers that are displayed in 3D. It is typically composed of a basemap layer, data layers, and 3D data. Learn more . The symbol A symbol defines the properties used to display a geometry or text. Learn more type must match the geometry A geometry is a geometric shape, such as a point, polyline, or polygon, that contains one or more coordinates and a spatial reference. Learn more type of the graphic. Learn more about how to create graphics in Graphics.

  2. Apply a renderer (with symbols) to a data layer: Use this approach to define the style for all features in a data layer in a map or scene. A renderer A renderer is a collection of rules and symbols used to display the data in a layer. Learn more defines the rules for applying symbols to features, such as how to color or size features based on a data value.

Simple renderer

Location styles are defined with a simple renderer. Using a simple renderer, all visual properties of the symbol (e.g. size, color, opacity, texture, etc.) are fixed for each feature. The primary purpose of the visualization is to show where a feature is located, not specifics about the feature’s attributes. For example, if you want to know the locations of weather stations, but you don’t need to know additional attribute information about each station, you should render all points with the same symbol.

Simple renderer
36 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (2D points)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
color-scheme: dark;
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map center="-94.963006, 37.783559" zoom="3">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="bottom-right" expanded>
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
<script type="module">
const [Map, FeatureLayer, SimpleMarkerSymbol, SimpleRenderer] = await $arcgis.import([
"@arcgis/core/Map.js",
"@arcgis/core/layers/FeatureLayer.js",
"@arcgis/core/symbols/SimpleMarkerSymbol.js",
"@arcgis/core/renderers/SimpleRenderer.js",
]);
const viewElement = document.querySelector("arcgis-map");
const renderer = new SimpleRenderer({
label: "Stations",
symbol: new SimpleMarkerSymbol({
size: 3,
color: [0, 255, 255],
outline: null,
}),
});
19 collapsed lines
const weatherStations = new FeatureLayer({
title: "Current Weather and Wind Station Data",
portalItem: {
id: "cb1886ff0a9d4156ba4d2fadd7e8a139",
},
renderer: renderer,
});
// Add the layers to the map
const map = new Map({
basemap: "dark-gray-vector",
layers: [weatherStations],
});
viewElement.map = map;
</script>
</body>
</html>

Symbols

The style for features in a map are defined by a symbol. The symbol should represent the data with either what the symbol represents or how the feature is related to other features with respect to location and the data attributes being mapped.

The symbol chosen for a layer depends on the view in which it is rendered (2D or 3D), and the geometry type of the features in the layer (point, polyline, polygon, or mesh).

2D Symbols

You use 2D symbols to style point, line, and polygon geometries and display them in a map. The main types are marker, line, fill, picture, and text symbols. See below for more examples.

Simple marker and line symbols
const symbol = new SimpleMarkerSymbol({
color: "rgba(0,128,155,0.8)",
size: "10px",
outline: new SimpleLineSymbol({
width: 0.5,
color: "rgba(255,255,255,0.3)",
}),
});

3D Symbols

You use 3D symbols to style point, line, polygon, and mesh geometries and display them in a scene. In a scene, you can choose between two types of symbols:

  • 2D symbols such as marker symbols, line symbols and polygon fill symbols.
  • 3D symbols such as 3D model symbols, path symbols and extruded polygon symbols.

See below for more examples.

PointSymbol3D and IconSymbol3DLayer
const pointSymbol = new PointSymbol3D({
symbolLayers: [
new IconSymbol3DLayer({
resource: { href: "pin.svg" },
size: 15,
material: {
color: "#4c397f",
},
anchor: "bottom",
}),
],
});

2D examples

Points

To visualize the location of point features in a map, set a simple marker symbol, picture marker symbol, or a CIM symbol A Cartographic Information Model (CIM) symbol is an advanced, multi-layer symbol produced by ArcGIS Pro, client APIs, or developer code. Learn more in a simple renderer A simple renderer is a renderer that defines a single symbol used to display all features in a layer. Learn more , and set the renderer on the layer. All features will display in the view with the same symbol.

Item page
CodePen
Sandbox Download
Weather station locations are represented by dots.
Location style (2D points)
21 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (2D points)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
color-scheme: dark;
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="2a0b2d7d23ef42a9ac689676bfef3fba">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="bottom-right" expanded>
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

Lines

To visualize the location of line features in a map, use a simple line symbol or a cim symbol, and a simple renderer.

Item page
CodePen
Sandbox Download
Major highway locations displayed by a line symbol.
Location style (2D lines)
21 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (2D lines)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
color-scheme: dark;
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="0399bd26aad24a96ad741733378f7ff4">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="top-right" expanded>
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

Polygons

To visualize the location of polygon features in a map, you can use either a simple fill symbol, a picture fill symbol, or a CIM symbol. You can also use simple marker symbol, picture marker symbol, web style symbol, or a CIM symbol to visualize the centroid of the polygon.

Item page
CodePen
Sandbox Download
The distribution of American Indian, Alaska Native, and Native Hawaiian (AIANNH) areas in the United States are shown using opaque, unicolored polygons.
Location style (2D polygons)
20 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (2D polygons)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="1e200b7c14154c2baddd1383185b7fd9">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="top-right" expanded>
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

3D examples

Points

To visualize the location of point features in a scene, set a marker symbol or a 3D model symbol in a simple renderer, and set the renderer on the layer. All features will display in the view with the same symbol.

Item page
CodePen
Sandbox Download
Cities, represented by pin markers, are displayed across the globe.
Location style (3D points)
21 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (3D points)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
color-scheme: dark;
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-scene item-id="22a4a77a55ea46da925e04210d5c2cde">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
<arcgis-expand slot="top-right">
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-scene>
2 collapsed lines
</body>
</html>

Lines

To visualize the location of line features in a scene, set a line symbol or a 3D path symbol in a simple renderer, and set the renderer on the layer.

Item page
CodePen
Sandbox Download
The metro lines in Lyon are styled using a path symbol.
  1. Create a path symbol with a width of 5 and a height of 30 meters.
  2. Add it to a simple renderer.
  3. Apply the renderer to the data layer.
Location style (3D lines)
37 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (3D lines)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-scene item-id="4a711462369c4334972dcd39b064d214">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
<arcgis-expand slot="top-right" expanded>
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-scene>
<script type="module">
const [FeatureLayer, SimpleRenderer, LineSymbol3D, PathSymbol3DLayer] = await $arcgis.import([
"@arcgis/core/layers/FeatureLayer.js",
"@arcgis/core/renderers/SimpleRenderer.js",
"@arcgis/core/symbols/LineSymbol3D.js",
"@arcgis/core/symbols/PathSymbol3DLayer.js",
]);
const viewElement = document.querySelector("arcgis-scene");
const renderer = new SimpleRenderer({
symbol: new LineSymbol3D({
symbolLayers: [
new PathSymbol3DLayer({
profile: "quad",
material: {
color: [46, 255, 238],
},
width: 5,
height: 30,
join: "miter",
cap: "round",
anchor: "bottom",
profileRotation: "all",
}),
],
}),
});
26 collapsed lines
viewElement.environment = {
lighting: {
directShadowsEnabled: true,
},
};
/* Create layer with the transit lines */
const transitLayer = new FeatureLayer({
url: "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/subway_tcl_stations_lines_wgs84/FeatureServer/0",
copyright:
"Data from <a href='https://data.beta.grandlyon.com/en/datasets/lignes-metro-funiculaire-reseau-transports-commun-lyonnais/info'>Data Grand Lyon - Sytral</a>",
elevationInfo: {
mode: "relative-to-ground",
offset: 10,
},
title: "Transit lines in Lyon",
definitionExpression: "sens='Aller'",
renderer: renderer,
});
await viewElement.componentOnReady();
viewElement.map.layers.add(transitLayer);
</script>
</body>
</html>

Polygons

To visualize polygon features in a scene, use a fill symbol or extrude the polygon based on real-world heights.

Item page
CodePen
Sandbox Download
Building footprints are extruded with a fixed height to display schematic buildings in a city.
Location style (3D polygons)
20 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Location style (3D polygons)</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-scene item-id="c350c427b9fc41ca8355d819f86bfeb4">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
<arcgis-compass slot="top-left"></arcgis-compass>
<arcgis-expand slot="top-right">
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-scene>
2 collapsed lines
</body>
</html>