Waze Map Editor JavaScript SDK
    Preparing search index...

    Class Segments

    Methods for dealing with Segments.

    Index

    Methods

    • Add an alternate street address to the segment.

      Parameters

      • args: { segmentIds: number[]; streetId: number }
        • segmentIds: number[]

          ID of segments to add an alternate street to.

        • streetId: number

          Street id for the alternate street.

      Returns void

      DataModelNotFoundError in case the street or the segment is not found in the WME data model

      InvalidStateError in case no segment id is provided.

    • Splits two intersecting segments into four segments at their intersection point.

      This method divides two intersecting segments into four new segments, with a new node created at the intersection point to connect them.

      Note: This method only splits two segments, and they should have the same road type

      Parameters

      • args: { segmentIds: [number, number] }
        • segmentIds: [number, number]

          Ids of segments to be split.

      Returns { sourceSplits: [number, number]; targetSplits: [number, number] }

      the ids of the four newly created segments.

      DataModelNotFoundError in case the segment is not found in the WME data model

      InvalidStateError if the segments are not allowed to be split or if they don't intersect or if they have different road types.

    • Add a new segment to the map.

      Parameters

      Returns number

      segment id of the new segment

      InvalidStateError if not allowed to add a new segment

    • Create a new roundabout at specified point.

      Parameters

      • args: { center: LonLat; rx: number; ry: number }
        • center: LonLat

          Center of the roundabout in WGS84 format.

        • rx: number

          Roundabout width in meters.

        • ry: number

          Roundabout height in meters.

      Returns number[]

      ids of roundabout segments

      InvalidStateError in roundabout doesn't cross any segments.

    • Delete a segment from the map.

      Parameters

      • args: { segmentId: number }
        • segmentId: number

          An id of the segment to be deleted.

      Returns void

      DataModelNotFoundError in case the segment is not found in the WME data model

      InvalidStateError in case deletion of the segment is not allowed

    • Parameters

      • args: { segmentId: number }
        • segmentId: number

          An id of the segment to get address for.

      Returns SegmentAddress

      an address of the segment with provided id.

      DataModelNotFoundError in case the segment is not found in the WME data model

    • Returns Segment[]

      an array of all the segments in the WME data model

    • Parameters

      • args: { segmentId: number }
        • segmentId: number

          An id of the segment to find.

      Returns null | Segment

      segment with id, or null if not found in the WME data model

    • Gets segments connected to a specified segment. This method retrieves an array of segments connected to the segment identified by segmentId. You can check for connections in either the forward or reverse direction using the reverseDirection parameter. Forward direction checks if segments share the node defined by the fromNodeID attribute. Reverse direction checks if segments share the node defined by the toNodeID attribute.

      Parameters

      • args: { reverseDirection?: boolean; segmentId: number }
        • OptionalreverseDirection?: boolean

          If segments should be connected in reverse direction, defaults to false.

        • segmentId: number

          An id of the segment to find connected segments for.

      Returns Segment[]

      connected segments in specified direction

      DataModelNotFoundError in case the segment is not found in the WME data model

    • Identifies which segments in a given list of IDs are directionally reversed.

      The direction is determined relative to the first segment in the list, which is considered 'forward'. Any other segment connected against this flow (e.g., head-to-head or tail-to-tail) is marked as reversed.

      Parameters

      • args: { segmentIds: number[] }

      Returns Segment[]

      An array of segments that are considered reversed within the provided list.

      DataModelNotFoundError if any segment ID is not found in the WME data model.

    • Returns RoadType[]

      all possible road types and their localised names.

    • Parameters

      • args: { segmentId: number }

      Returns Node[]

      array of nodes virtually connected to the specified segment.

      DataModelNotFoundError If the specified segment is not found.

      DataModelNotFoundError If the connected node is not found.

    • Parameters

      • args: { segmentId: number }
        • segmentId: number

          An id of the segment to get WKT geometry for.

      Returns string

      the WKT string representation of the segment's geometry

      DataModelNotFoundError in case the segment is not found in the WME data model

    • Parameters

      • args: { permission?: SegmentPermission; segmentId: number }
        • Optionalpermission?: SegmentPermission

          A name of the permission to check. If not provided, the method checks whether the current user has any permissions for this segment.

        • segmentId: number

          An id of the segment to check the permissions for.

      Returns boolean

      whether the current user has a permission for this segment or not.

      DataModelNotFoundError in case the segment is not found in the WME data model.

    • Parameters

      Returns boolean

      boolean indicating whether specified road type is drivable.

    • Parameters

      • args: { segmentId: number }
        • segmentId: number

          An id of the segment to check.

      Returns boolean

      true if the segment is a toll road or has a toll-free restriction

      DataModelNotFoundError in case the segment is not found in the WME data model

    • Merge segments together.

      Parameters

      • args: { segmentIds: number[] }
        • segmentIds: number[]

          Ids of segments to be merged.

      Returns void

      DataModelNotFoundError in case the segment is not found in the WME data model

      InvalidStateError in case merging of specified segments not allowed

    • Splits a segment at a specific point.

      This method divides a segment into two segments at the provided point.

      Parameters

      • args: { segmentId: number; splitPoint: Point }
        • segmentId: number

          The ID of the segment to split.

        • splitPoint: Point

          GeoJSON point at which to split the segment

      Returns [number, number]

      two segments the original segment was split into.

      DataModelNotFoundError If the specified segment is not found.

      InvalidStateError If editing is not allowed, the segment cannot be split, or the split action fails.

    • Update segment address or alternative addresses.

      Parameters

      • args: { alternateStreetIds?: number[]; primaryStreetId?: number; segmentId: number }
        • OptionalalternateStreetIds?: number[]

          New ids of the alternative streets for the segment.

        • OptionalprimaryStreetId?: number

          An id of the new street for the segment.

        • segmentId: number

          The id of the segment to update the address for.

      Returns void

      DataModelNotFoundError in case the segment or streets not found in the WME data model

    • Update segment attributes.

      Parameters

      • args: {
            direction?: SegmentDirection;
            elevationLevel?: number;
            flagAttributes?: Pick<
                SegmentFlagAttributes,
                "tunnel"
                | "unpaved"
                | "headlights"
                | "nearbyHOV",
            >;
            fromLanesInfo?: null | SegmentLanesInfo;
            fwdSpeedLimit?: null | number;
            geometry?: LineString;
            hasToll?: boolean;
            lockRank?: UserRank;
            revSpeedLimit?: null | number;
            roadType?: RoadTypeId;
            routingRoadType?: 1 | 2 | 3 | 6 | 7;
            segmentId: number;
            toLanesInfo?: null | SegmentLanesInfo;
        }
        • Optionaldirection?: SegmentDirection

          New traffic direction for the segment.

        • OptionalelevationLevel?: number

          New elevationLevel for the segment.

        • OptionalflagAttributes?: Pick<SegmentFlagAttributes, "tunnel" | "unpaved" | "headlights" | "nearbyHOV">

          New flag attributes for the segment. Allows updating flags such as unpaved, tunnel, nearbyHOV, and headlights.

        • OptionalfromLanesInfo?: null | SegmentLanesInfo

          New lanes info for the segment in the forward direction, or null if lanes info has to be deleted. laneWidth should be provided in m or ft depending on the active units system.

        • OptionalfwdSpeedLimit?: null | number

          New max speed for the segment in the forward direction, in km/h.

        • Optionalgeometry?: LineString

          New geometry for the segment.

        • OptionalhasToll?: boolean

          New toll status for the segment. Will be set on both directions of the segment.

        • OptionallockRank?: UserRank

          New lock rank for the segment.

        • OptionalrevSpeedLimit?: null | number

          New max speed for the segment in the reverse direction, in km/h.

        • OptionalroadType?: RoadTypeId

          New road type for the segment.

        • OptionalroutingRoadType?: 1 | 2 | 3 | 6 | 7

          New routing road type of the segment.

        • segmentId: number

          The id of the segment to be updated.

        • OptionaltoLanesInfo?: null | SegmentLanesInfo

          New lanes info for the segment in the reverse direction, or null if lanes info has to be deleted. laneWidth should be provided in m or ft depending on the active units system.

      Returns void

      DataModelNotFoundError in case the segment is not found in the WME data model

      InvalidStateError if no attribute to update was provided or if not allowed to update the segment