# Working With 2D Well Layers

**Note**: you will need to include WellData and Well2D in your **Module Dependencies** list in addition to Viewer2D.

### Creating a well 2D layer for a XSection window

Well layers can only be added to a XSection window if that window already contains a seismic layer. In this example, we assume you have already created a well dataset wellData and a XSection window xsectionWindow.

NamedProps layerProperties = new NamedProps();

```
layerProperties.putProperty(IWellLayer.TRAJECTORY_IN_PLANE_COLOR, Color.RED);
```

IWellLayer layer = IWellLayer.factory.createLayer(xsectionWindow, wellData, layerProperties, false);

**Notes**: The axis seismic layer query **must have a fixed** inline or xline that is near the well for the track to be visible.

### Show/Hide the well tracks

```
    layerProperties.putProperty(IWellLayer.SHOW_WELL_LOG_TRACKS, true);
    layer.setProperties(layerProperties);
```

### Enable/Disable track background opaqueness

```
    layerProperties.putProperty(IWellLayer.TRACKS_OPAQUE, true);
    layer.setProperties(layerProperties);
```

### Set the width of the tracks

```
    layerProperties.putProperty(IWellLayer.WELL_TRACK_WIDTH, 10d);
    layer.setProperties(layerProperties);
```

### Add another track to the well layer

There are two track types: Linear and Logarithmic, they are both added the same way.

```
    ITrack newTrack  = layer.addTrack(TrackType.LINEAR);
```

### Get an existing track from the well layer

We assume there is at least one track currently in the layer for this example

```
        ITrack track = layer.getAllTracks()[0];
```

### Add a log curve to a track

Using the track we got from the previous example and assuming the well data has a curve named "KLOG":

```
    IWellData wellData = layer.getWellData();
    ILogCurve logCurve = wellData.getCurve("KLOG");
    ILogCurveShape logCurveShape = ILogCurveShape.Factory.createLogCurveShape(track, logCurve);
```

### Add a marker to a track

Using the track we got from the previous example and assuming the well data has a curve named "Maker1":

```
    IWellData wellData = layer.getWellData();
    IMarker marker = wellData.getMarker("Marker1");
    IMarkerShape markerShape = IMarkerShape.Factory.createMarkerShape(track, marker);
```

### Creating a well 2D layer for a Map window

In this example, we assume you have already created a well dataset wellData and a Map window mapWindow.

```
NamedProps layerProperties = new NamedProps();
layerProperties.putProperty(IMapWellLayer.TRAJECTORY_LINE_COLOR, Color.RED);
IMapWellLayer layer = IMapWellLayer.factory.createLayer(mapWindow, wellData, layerProperties, false);
```