▾
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
-
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. in a mapA map is a collection of layers that are displayed in 2D. It is typically composed of a basemap layer and data layers. or sceneA scene is a collection of layers that are displayed in 3D. It is typically composed of a basemap layer, data layers, and 3D data. . The symbolA symbol defines the properties used to display a geometry or text. type must match the geometryA geometry is a geometric shape, such as a point, polyline, or polygon, that contains one or more coordinates and a spatial reference. type of the graphic. Learn more about how to create graphics in Graphics. -
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. 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.
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.
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.
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
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>- Create a simple marker symbol and add it to a simple renderer.
- Set the renderer to a data layer.
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>Lines
To visualize the location of line features in a map, use a simple line symbol or a cim symbol, and a simple renderer.
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>- Create a simple line symbol and add it to a simple renderer.
- Set the renderer to the data layer.
33 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 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 basemap="dark-gray-vector" center="-95.389429, 29.792677" scale="577791"> <arcgis-zoom slot="top-left"></arcgis-zoom> <arcgis-expand slot="top-right" expanded> <arcgis-legend></arcgis-legend> </arcgis-expand> </arcgis-map>
<script type="module"> const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const viewElement = document.querySelector("arcgis-map"); await viewElement.viewOnReady(); viewElement.constraints.snapToZoom = false; // These autocast to SimpleRenderer and SimpleLineSymbol, respectively. const renderer = { type: "simple", symbol: { type: "simple-line", color: "#fb12ff", width: 1 }, };13 collapsed lines
const layer = new FeatureLayer({ // Fetch from a service containing primary road features. url: "https://services2.arcgis.com/FiaPA4ga0iQKduv3/ArcGIS/rest/services/Transportation_v1/FeatureServer/1", title: "US Road System", renderer, minScale: 0, maxScale: 0, });
viewElement.map.add(layer); // Add the layer to the map. </script> </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.
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>- Create a simple fill symbol and add it to a simple renderer.
- Set the renderer to the data layer.
32 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 center="-108.084015, 36.137375" zoom="6"> <arcgis-zoom slot="top-left"></arcgis-zoom> <arcgis-expand slot="top-right" expanded> <arcgis-legend></arcgis-legend> </arcgis-expand> </arcgis-map>
<script type="module"> const [Map, FeatureLayer] = await $arcgis.import(["@arcgis/core/Map.js", "@arcgis/core/layers/FeatureLayer.js"]);
const viewElement = document.querySelector("arcgis-map");
const statesFeatureLayer = new FeatureLayer({ title: "USA States Generalized Boundaries", url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_States_Generalized_Boundaries/FeatureServer", renderer: { type: "simple", symbol: { color: [0, 0, 0], outline: { color: [110, 110, 110], width: "0.93px" }, type: "simple-fill" }, }, });
const areasOfAIANNHFeatureLayer = new FeatureLayer({ title: "American Indian, Alaska Native, and Native Hawaiian Areas", url: "https://services2.arcgis.com/FiaPA4ga0iQKduv3/arcgis/rest/services/AIANNHA_v1/FeatureServer", renderer: { type: "simple", symbol: { color: [255, 255, 255], outline: { color: [255, 255, 255, 0.25], width: "1px" }, type: "simple-fill", }, }, });14 collapsed lines
const map = new Map({ basemap: "dark-gray-vector", layers: [statesFeatureLayer, areasOfAIANNHFeatureLayer], });
viewElement.map = map;
await viewElement.viewOnReady();
viewElement.map.basemap.referenceLayers.forEach((layer) => (layer.visible = false)); </script> </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.
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>- Create a marker symbol and add it to a simple renderer.
- Apply the renderer to the data layer so that each feature is displayed with the marker symbol.
42 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 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 { background: linear-gradient(150deg, #beb5ce, #a2c9e5) no-repeat; color-scheme: dark; height: 100%; margin: 0; } </style> </head>
<body> <arcgis-scene> <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>
<script type="module"> const [WebScene, FeatureLayer, LabelClass, SimpleRenderer, PointSymbol3D, IconSymbol3DLayer] = await $arcgis.import([ "@arcgis/core/WebScene.js", "@arcgis/core/layers/FeatureLayer.js", "@arcgis/core/layers/support/LabelClass.js", "@arcgis/core/renderers/SimpleRenderer.js", "@arcgis/core/symbols/PointSymbol3D.js", "@arcgis/core/symbols/IconSymbol3DLayer.js", ]);
const viewElement = document.querySelector("arcgis-scene");
const renderer = new SimpleRenderer({ symbol: new PointSymbol3D({ symbolLayers: [ new IconSymbol3DLayer({ resource: { href: "https://static.arcgis.com/arcgis/styleItems/Icons/web/resource/Pushpin3.svg", }, size: 15, material: { color: "#4c397f", }, anchor: "bottom", }), ], }), });115 collapsed lines
const webscene = new WebScene({ basemap: null, ground: { surfaceColor: [0, 0, 0, 0], }, });
viewElement.map = webscene;
viewElement.alphaCompositingEnabled = true; viewElement.camera = { position: { spatialReference: { wkid: 4326, }, x: 99.718352, y: 21.389592, z: 12752753.051205851, }, heading: 359.0535763661348, tilt: 0.16669195966464256, };
viewElement.constraints = { altitude: { min: 12752753.051205851, max: 25000000, }, };
viewElement.environment = { background: { type: "color", color: [0, 0, 0, 0], }, lighting: { date: "Sun Jul 15 2018 15:30:00 GMT+0900 (W. Europe Daylight Time)", }, starsEnabled: false, atmosphereEnabled: false, };
const countryBoundaries = new FeatureLayer({ url: "http://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Countries_(Generalized)/FeatureServer", title: "World Countries", renderer: { type: "simple", symbol: { type: "polygon-3d", symbolLayers: [ { type: "fill", material: { color: "white", }, }, ], }, }, });
const populationLayer = new FeatureLayer({ url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Cities_analysis/FeatureServer", definitionExpression: "POP > 6000000", renderer: renderer, screenSizePerspectiveEnabled: false, labelingInfo: [ new LabelClass({ labelExpressionInfo: { expression: "$feature.CITY_NAME" }, symbol: { type: "label-3d", symbolLayers: [ { type: "text", // autocasts as new TextSymbol3DLayer() material: { color: "#4c397f" }, size: 10, font: { family: "Open Sans", weight: "bold", }, halo: { color: "white", size: 1, }, }, ], }, }), ], });
const graticule = new FeatureLayer({ url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/World_graticule_15deg/FeatureServer", renderer: { type: "simple", symbol: { type: "line-3d", symbolLayers: [ { type: "line", material: { color: [255, 255, 255, 0.8], }, size: 1, }, ], }, }, });
webscene.addMany([countryBoundaries, graticule, populationLayer]); </script> </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.
- Create a path symbol with a width of 5 and a height of 30 meters.
- Add it to a simple renderer.
- Apply the renderer to the data layer.
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.
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>- Create an extruded polygon symbol and add it to a simple renderer.
- Apply the renderer to the data layer.
39 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 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 viewing-mode="local"> <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>
<script type="module"> const [Map, FeatureLayer, PolygonSymbol3D, ExtrudeSymbol3DLayer, SimpleRenderer] = await $arcgis.import([ "@arcgis/core/Map.js", "@arcgis/core/layers/FeatureLayer.js", "@arcgis/core/symbols/PolygonSymbol3D.js", "@arcgis/core/symbols/ExtrudeSymbol3DLayer.js", "@arcgis/core/renderers/SimpleRenderer.js", ]);
const viewElement = document.querySelector("arcgis-scene");
const renderer = new SimpleRenderer({ symbol: new PolygonSymbol3D({ symbolLayers: [ new ExtrudeSymbol3DLayer({ material: { color: "#ffc53d", }, size: 10, edges: { type: "solid", color: "#a67400", size: 1.5, }, }), ], }), });30 collapsed lines
const buildingsLayer = new FeatureLayer({ title: "Building footprints height", url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/building_footprints_height/FeatureServer", renderer, });
const map = new Map({ basemap: "gray-vector", ground: "world-elevation", layers: [buildingsLayer], });
viewElement.map = map; await viewElement.viewOnReady(); viewElement.camera = { position: { spatialReference: { wkid: 102100, }, x: -8358646.406463122, y: 4625713.42998881, z: 78.97484669121653, }, heading: 347.47207301490795, tilt: 75.01499195356008, }; </script> </body></html>