AxisValueType.MapCoordsDegMinSecNESW and 180 Deg Longitude

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
JamesD
Posts: 5
Joined: Sun May 05, 2019 2:02 pm

AxisValueType.MapCoordsDegMinSecNESW and 180 Deg Longitude

Post by JamesD » Fri Jun 21, 2019 8:38 pm

I'm plotting a 3D section of the ocean floor, with axes X, Z, Y = Longitude, Latitude, and Depth respectively. X and Z are defined:

Code: Select all

            // Setup X-Axis as Longitude
            _chart.View3D.XAxisPrimary3D.ValueType = AxisValueType.MapCoordsDegMinSecNESW;
            _chart.View3D.XAxisPrimary3D.Title.Text = "Longitude";

            // Setup Z-Axis as Latitude
            _chart.View3D.ZAxisPrimary3D.ValueType = AxisValueType.MapCoordsDegMinSecNESW;
            _chart.View3D.ZAxisPrimary3D.Title.Text = "Latitude";
When NOT crossing the International Date Line (Longitude = 180) everything looks fine:
Center_62.5_N175.jpg
Center_62.5_N175.jpg (139.13 KiB) Viewed 15127 times
Center_62.5_N175_Code.jpg
Center_62.5_N175_Code.jpg (381.09 KiB) Viewed 15127 times
But when crossing the IDL, eg Westmost = 175 to Eastmost = -175, the X-axis labels and values don't follow:
Center_62.5_180.jpg
Center_62.5_180.jpg (173.77 KiB) Viewed 15127 times
Any suggestions?

JamesD
Posts: 5
Joined: Sun May 05, 2019 2:02 pm

Re: AxisValueType.MapCoordsDegMinSecNESW and 180 Deg Longitu

Post by JamesD » Fri Jun 21, 2019 8:39 pm

Here's the final screen shot since a max of three per post is allowed:
Center_62.5_180_Code.jpg
Center_62.5_180_Code.jpg (382.58 KiB) Viewed 15126 times

Arction_LasseP
Posts: 141
Joined: Wed Mar 27, 2019 1:05 pm

Re: AxisValueType.MapCoordsDegMinSecNESW and 180 Deg Longitu

Post by Arction_LasseP » Tue Jun 25, 2019 11:46 am

Hello James,

We investigated this issue and found out currently there is no setting, which allows the map coordinates to behave correctly when crossing the International Date Line. Technically this requires the axis ranges to be something like
175->180->-180->-175 which is not possible. Instead, the axis values are automatically switched so that minimum is always smaller than maximum. This feature is something we could fix/change in the future.

There is a workaround that could help here: using custom axis ticks. For example:

Code: Select all

private int east = -175, west = 175;
_chart.View3D.XAxisPrimary3D.SetRange(west, east); // This will be switched so that minimum is -175 and maximum 175

_chart.View3D.XAxisPrimary3D.ValueType = AxisValueType.MapCoordsDegMinSecNESW;
_chart.View3D.XAxisPrimary3D.Title.Text = "Longitude";
_chart.View3D.XAxisPrimary3D.AutoFormatLabels = false; // Custom ticks might not work correctly with AutoFormatLabels enabled 
_chart.View3D.XAxisPrimary3D.CustomTicksEnabled = true;
_chart.View3D.XAxisPrimary3D.CustomTicks.Add(new CustomAxisTick(_chart.View3D.XAxisPrimary3D, -175, "175°0'0\"E"));
_chart.View3D.XAxisPrimary3D.CustomTicks.Add(new CustomAxisTick(_chart.View3D.XAxisPrimary3D, -70, "178°0'0\"E"));
_chart.View3D.XAxisPrimary3D.CustomTicks.Add(new CustomAxisTick(_chart.View3D.XAxisPrimary3D, 0, "IDL"));
_chart.View3D.XAxisPrimary3D.CustomTicks.Add(new CustomAxisTick(_chart.View3D.XAxisPrimary3D, 70, "178°0'0\"W"));
_chart.View3D.XAxisPrimary3D.CustomTicks.Add(new CustomAxisTick(_chart.View3D.XAxisPrimary3D, 175, "175°0'0\"W"));
_chart.View3D.XAxisPrimary3D.InvalidateCustomTicks();
You could for instance check if Westmost -value is larger than Eastmost. If this is true, enable custom ticks, otherwise keep them disabled. You might also need to solve how to convert axis values to correct longitude values.

Hope this is helpful.

JamesD
Posts: 5
Joined: Sun May 05, 2019 2:02 pm

Re: AxisValueType.MapCoordsDegMinSecNESW and 180 Deg Longitu

Post by JamesD » Thu Jun 27, 2019 12:34 pm

Thanks, I'll give it a try and see what I can do...

Post Reply