Forum Discussion
Mapa Azure no une dos puntos
- 1 year ago
Hi lfuentealbab ,
You can try to troubleshoot by implementing a check in your code to automatically detect when a line crosses the 180° meridian. The logic is simple: if the absolute difference between two longitude values is greater than 180°, you’re likely crossing the Date Line. Once detected, you have two reliable options to correct the line rendering.
The first option is to adjust the longitude values to a 0° to 360° range. For example, if you have a point at -170°, convert it to 190° by adding 360. This makes the distance between 170° and 190° only 20°, which helps the map engine interpret the line correctly. However, this method only works if the map engine supports the 0–360 format.The second and more robust solution is to split the line into two smaller segments using a GeoJSON MultiLineString object. Instead of drawing a direct line from 170° to -170°, you break it into two parts: one from 170° to 180°, and the other from -180° to -170°. This ensures that each line segment stays on its respective side of the Date Line, and the mapping engine can render the route accurately without drawing an unintended arc across the globe.
If you’re using the Azure Maps JavaScript SDK, you can pass this corrected GeoJSON directly to atlas.data.Feature and display it without issues. This approach gives you full control over how lines are rendered across the map and eliminates the visual bugs caused by crossing the 180° longitude line.
Hope this helps.
Warm Regards,
Chaithra E.
Hi lfuentealbab ,
We would like to confirm if you've successfully resolved this issue or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Chaithra E.
Buenos dias Chaithra, lementablemente no he podido resolver este asunto aun, espero que alguien pueda encontrar alguna solucion a este problema
Gracias.,
Luis F.