new Annotation(location, factory, options)
Creates a new annotation given its location and initialization options.
Declaration
constructor(
location: Coordinate | Place | SearchAutocompleteResult,
factory: (
location?: Coordinate,
options?: AnnotationConstructorOptions,
) => HTMLElement,
options?: AnnotationConstructorOptions,
);Parameters
- location:
The coordinate where the annotation appears.
- factory:
A factory function that returns a DOM element that represents the annotation.
- options:
A hash of properties MapKit JS uses to initialize the annotation.
Return Value
A Annotation instance.
Discussion
The factory function returns a DOM element to represent the annotation. It can be a single element or a containing element with subelements. MapKit JS calls this function with the following two arguments:
coordinate(Coordinate) — The annotation’s coordinate.options(AnnotationConstructorOptions) — You can use options you pass to the annotation constructor to add context to the custom annotation.
The options include title and subtitle, which appear in a callout if they’re present.