View on GitHub Sample viewer app

Show different kinds of multilayer symbols on a map.

Image of render multilayer symbols

Use case

Allows you to customize a graphic with a multilayer symbol. For example, you may want more customizable symbols than those that are provided with the API to display a unique representation of a landmark.

How to use the sample

The sample loads with multilayer symbols displayed for points, polylines, and polygons.

How it works

  1. Create multilayer symbols for each predefined 2D simple symbol style.
    • For multilayer point symbols, use the MultilayerPointSymbol constructor.
    • For multilayer polyline symbols, use the MultilayerPolylineSymbol constructor.
    • For multilayer polygon symbols, use the MultilayerPolygonSymbol constructor.
  2. Create Graphics by passing in a Geometry and the associated multilayer symbol.
  3. Add graphics to the graphics overlay with graphicsOverlay.getGraphics.add(graphic)

Relevant API

  • Graphic
  • GraphicsOverlay
  • MultiLayerPoint
  • MultiLayerPolygon
  • MultiLayerPolyline
  • PictureMarkerSymbolLayer
  • SolidFillSymbolLayer
  • SolidStrokeSymbolLayer
  • VectorMarkerSymbolLayer

Tags

graphic, marker, multilayer, picture, symbol

Sample Code

module-info.java module-info.java RenderMultilayerSymbolsSample.java
/*
* Copyright 2022 Esri.
*
* 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.
*/
module com.esri.samples.render_multilayer_symbols {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
exports com.esri.samples.render_multilayer_symbols;
}