Home > @magiclane/maps-sdk > SocialOverlay

SocialOverlay class

Static service for crowd-sourced social event reporting and interaction.

Provides a complete system for creating, managing, and interacting with user-generated reports about real-time road conditions and incidents.

Overlays

Signature:

export declare abstract class SocialOverlay 

Properties

Property

Modifiers

Type

Description

reportsOverlayInfo

static

readonly

SocialReportsOverlayInfo

Provides access to social report category hierarchy and metadata.

transferStatistics

static

readonly

TransferStatistics

Provides network traffic statistics for social reports operations.

Methods

Method

Modifiers

Description

addComment({ item, comment, onComplete, }, input)

static

Adds a text comment to an existing social report.

Submits user commentary on a social report, visible to all users viewing that report. Comments support community discussion and provide additional context. The comment appears in OverlayItem.previewData. Operation executes asynchronously with result delivered via onComplete callback.

cancel(progressListener)

static

Cancels an ongoing social overlay operation.

Terminates an active asynchronous operation started by methods returning ProgressListener, such as report(), confirmReport(), denyReport(), deleteReport(), updateReport(), or addComment(). Cancellation prevents the onComplete callback from executing.

confirmReport(item, onComplete)

static

Provides positive feedback (upvote) for a report.

Confirms that a reported event is accurate and still in effect, increasing the report's score value. Each user can confirm or deny a report only once. The operation executes asynchronously with result delivered via onComplete callback.

deleteReport(item, onComplete)

static

Permanently removes a user's own report.

Deletes a social report created by the current user, removing it completely from the map for all users. Only the original report creator has authority to delete their reports. The operation executes asynchronously with result delivered via onComplete callback.

denyReport(item, onComplete)

static

Provides negative feedback (downvote) for an inaccurate report.

Denies that a reported event is accurate or still in effect, decreasing the report's score. Reports with many downvotes are automatically removed to maintain information quality. Each user can confirm or deny a report only once. The operation executes asynchronously with result delivered via onComplete callback.

getReportSnapshot({ item, onComplete, }, input)

static

Retrieves the image snapshot associated with a social report.

Downloads the photo attached to a social report when submitted with image data. Only applicable to Social Reports Overlay items. Returns image via onComplete callback with Img result. Operation executes asynchronously with progress tracking.

prepareReporting({ dataSource, categId, }, input)

static

Prepares a report using the device's current high-accuracy position.

Validates position accuracy and rate limits, then generates a preparation ID for submitting a report via report(). Required for most report categories. The position must be classified as high-accuracy by the map-matching system to ensure report reliability.

Operates in two modes based on categId: - **Preparing mode** (categId = 0): Returns a preparation ID for use with report. The ID expires after a short time (typically minutes). - **Dry run mode** (categId ≠ 0): Tests if reporting is possible for the category without actually preparing. Returns error code as integer.

prepareReportingCoords(coords, categId)

static

Prepares a report for submission using explicit coordinates.

Validates and prepares a report at the specified geographic location without requiring active position tracking. Works only for Weather Hazard and its subcategories. Other categories require prepareReporting with high-accuracy position data.

Operates in two modes based on categId: - **Preparing mode** (categId = 0): Returns a preparation ID for use with report. The ID expires after a short time (typically minutes). - **Dry run mode** (categId ≠ 0): Tests if the category can be reported at these coordinates without actually preparing. Returns error code as integer.

registerReportListener(report, listener)

static

Registers a listener to monitor changes to a specific social report.

Subscribes listener to receive notifications when the specified social report is modified (e.g., updated parameters, new comments, score changes). Use with unregisterReportListener to stop monitoring.

report({ prepareId, categId, description, snapshot, format, params, onComplete, }, input)

static

Submits a prepared social event report to the community.

Uploads a previously prepared report (via prepareReporting or prepareReportingCoords) with the specified category, optional description, image snapshot, and custom parameters. The report becomes visible to all users with social overlay enabled and displays for a limited duration before automatic removal.

unregisterReportListener(report, listener)

static

Unregisters a listener from monitoring a specific social report.

Removes listener subscription from the specified social report, stopping change notifications. Call when no longer interested in report updates to prevent memory leaks and unnecessary callbacks.

updateReport({ item, params, onComplete, }, input)

static

Modifies parameters of an existing owned report.

Updates custom parameters for a report created by the current user, such as location address or other metadata. The params structure must follow the format from OverlayItem.previewDataParameterList. Only the original report creator has authority to update their reports.