Skip to main content

GraphicsLayer

Introduction

The GraphicsLayer is used to display arbitrary graphics on a map. It can contain multiple Graphic components as children and is commonly used for temporary or dynamic content:

import React from "react";
import { GraphicsLayer, Graphic, MapView } from "esrieact";

export const ReactMap: React.FC = () => {
return (
<MapView>
<GraphicsLayer>
<Graphic
geometry={{
type: "point",
x: -17565473,
y: 2449593.5,
spatialReference: { wkid: 102100 },
}}
symbol={{
type: "simple-marker",
color: "red",
}}
/>
</GraphicsLayer>
</MapView>
);
};

Props

Props extends GraphicsLayer properties

children

Children components can be any of the following esrieact components:

  • LayerView component
  • Graphic or multiple Graphic components
  • Any Renderer component that is compatible with a GraphicsLayer

events

Standard events on an __esri.Layer:

  "layerview-create": __esri.FeatureLayerLayerviewCreateEventHandler;
"layerview-create-error": __esri.FeatureLayerLayerviewCreateErrorEventHandler;
"layerview-destroy": __esri.FeatureLayerLayerviewDestroyEventHandler;