How to properly handle anti-meridian (International Date Line) crossings in Azure Maps route visualization?

Pranav Bilurkar 20 Reputation points
2025-08-14T08:18:30.5533333+00:00

Background

I'm developing a shipping route visualization application using Azure Maps SDK 3.6.1 and encountering issues with routes that cross the International Date Line (±180° longitude). Unlike Google Maps and Bing Maps, Azure Maps doesn't automatically handle anti-meridian crossings (that's what I read in articles), causing route lines to span the entire world instead of showing the correct Pacific Ocean crossing.

Specific Issue

When GPS coordinates jump from near +180° to near -180° (or vice versa), Azure Maps draws a straight line spanning 359° of longitude instead of the shorter ~1° actual route segment.image-20250814-060911.png

Example coordinates from real shipping data:

Point A: longitude: -179.86°, latitude: -33.26°
Point B: longitude: 179.95°, latitude: -33.41°
Time difference: 1 hour (normal ship movement)
Actual movement: ~20 nautical miles eastward
Azure Maps displays: Line spanning almost entire world
  1. What is the recommended Microsoft/Azure approach for handling International Date Line crossings in route visualization?
  2. Does Azure Maps have any built-in utilities or methods for handling anti-meridian crossings
  3. Are there plans to add automatic anti-meridian handling to Azure Maps SDK similar to other mapping platforms?

Expected Behavior

Routes crossing the International Date Line should display as short Pacific Ocean segments, not world-spanning lines, similar to how Google Maps and Bing Maps handle this automatically.

Thank you for any guidance!

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
{count} votes

Answer accepted by question author
  1. rbrundritt 21,576 Reputation points Microsoft Employee Moderator
    2025-08-14T14:34:51.2133333+00:00

    Azure Maps uses MapLibre (forked version of Mapbox) under the hood for rendering. With this in mind, there are a few different ways to get a line to cross the antemeridian:

    1. You can use longitude values outside the -180/180 range. So if you have a line with two points with longitude values 170 and 210, it should cross the antemeridian when rendered.
    2. The atlas.math namespace provides a couple of methods for modifying the geometry so that it crosses the antemeridian.
    Function name Returns Description
    getPathDenormalizedAtAntimerian(LineString | Position[]) Position[] Denormalizes path on antimeridian, this makes lines with coordinates on the opposite side of the antimeridian to always cross it. Note that the path crossing antimeridian will contain longitude outside of -180 to 180 range. See getPathSplitByAntimeridian when this is not desired.
    getPathSplitByAntimeridian(LineString | Position[]) Position[][] Split path on antimeridian into multiple paths. See getPathDenormalizedAtAntimerian when this is not desired.
    getGeodesicPaths(LineString | Position[], number) Position[][] Takes an array of positions objects and fills in the space between them with accurately positioned positions to form an approximated Geodesic path broken by antimeridian into multiple sub-paths.
    getRegularPolygonPaths(Position | Point, number, number, string | DistanceUnits, number) Position[][] Calculates an array of position objects that are an equal distance away from a central point to create a regular polygon broken by antimeridian into multiple sub-paths.
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.