Add Shapes To The Map

You can add several different shapes to a map. Always follow this procedure: add a specific shape to a layer group, then add the layer group to the map. You can add an unlimited number and any type of shapes to a single layer group.

In the following code sample, we're adding a point to the map:

Creating a rectangle (when creating a rectangle, the two coordinate pairs represent two corners of a rectangle):

Creating a circle (center coordinates are specified, the radius is measured in meters):

Creating a circle point (center coordinates are specified, the radius is measured in pixels):

Creating an area (polygon):

The coordinates specify points in a polygon. Note: A polygon is a closed shape, meaning the last point is connected to the first point.

Creating a line:

Each coordinate pair represents a point on the line (e.g. waypoints in an itinerary).

Creating a popup point:

A popup point is a special point that defines a fixed bubble. You can set the contents of the bubble and add any component.

Creating a DivPoint:

A DivPoint is a special point that allows you to enclose contents in a container. (Thus, it's a container with fixed coordinates.)

Creating a DivLayer:

A DivLayer is a special layer. It has to be added to the Map directly, not to a layerGroup. Its upper right corner is fixed in the upper right corner of the map. The DivLayer always covers a portion of the map. Use the DivLayer to display any component (text, image, chart, etc.).