I am finally revisiting this and I have some code to show the problem. It is a code that sets up a map with a background layer just for reference then a dynamic layer and adds in 2 points.
Those 2 points are definitely less than 90 degrees in Lat and Long.
I then try to zoom to show both points. I get a failure:
System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
Why?
’ Minimal test platform
’ Add 2 points to a SQL Server database
’ Zoom to show those 2 points
Imports ThinkGeo.MapSuite.Core
Imports ThinkGeo.MapSuite.DesktopEdition
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
’ Set up the map - Countries background and zoom to show the whole world.
Dim WorldCountriesLayer As ShapeFileFeatureLayer
Dim BackgroundOverlay As New LayerOverlay()
Dim TrailLayer As MsSql2008FeatureLayer
Dim DynamicLayerOverlay As LayerOverlay = New LayerOverlay()
Dim ConnectionString As String
Dim conn = New SqlConnection(ConnectionString)
Dim cmd As SqlCommand = Nothing
’ Set the worldLayer with a preset Style, as AreaStyles.Country1 has YellowGreen background and black border, our worldLayer will have the same render style.
WorldCountriesLayer = New ShapeFileFeatureLayer(“C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Full Edition 5.5\Samples\SampleData\Data\Countries02.shp”)
WorldCountriesLayer.Name = “WorldCountriesLayer”
WorldCountriesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1
’ Make ocean blue
WinformsMap1.BackgroundOverlay.Name = “BackgroundOverlay”
WinformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
‘This is necessary - not displayed if this line is commented out.
WorldCountriesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
’ put the layer into an overlay then the overlay into the map, then set the initial extents of the map then refresh to display the map.
BackgroundOverlay.Layers.Add(“WorldCountriesLayer”, WorldCountriesLayer) ’ add the layer to the overlay
WinformsMap1.Overlays.Add(“BackgroundOverlay”, BackgroundOverlay) ’ add the overlay to the map
WinformsMap1.CurrentExtent = New RectangleShape(100, 5.5, 105, 1)
WinformsMap1.Refresh()
’ Add TrailLayer
TrailLayer = New MsSql2008FeatureLayer(“Data Source=CM\SQLEXPRESS;Initial Catalog=MVMSuiteTest;Integrated Security=True;Connection Timeout=0”, “Trails”, “ID”)
TrailLayer.Srid = 4326
TrailLayer.Name = “TrailLayer”
TrailLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = New GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Blue), 1)
TrailLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
DynamicLayerOverlay.Layers.Add(“TrailLayer”, TrailLayer)
‘Adds the LayerOvelay to the Overlays collection of the map with id “VesselLyrOverlay”
WinformsMap1.Overlays.Add(“ShipLayerOverlay”, DynamicLayerOverlay)
Dim InsertPoints As Boolean = True
If InsertPoints Then
’ Add points to TrailLayer at 90, 180 and another at -90, -180.
‘Dim SQLString As String = "INSERT INTO Trails(ID, Name, VLon, VLat, VSpd, VCMG, Altitude, Voltage, IO, OceanRegion, VDateTime, RDateTime, WGS84Loc, Origin, MsgType, RPM01, FuelFlow01) " + “VALUES (” + VesselID.ToString + “, '” + VesselID.ToString + "’, " + Longitude.ToString + ", " + Latitude.ToString + ", " + Speed.ToString + ", " + Heading.ToString + “, '” + Altitude + "’, ‘" + Voltage.ToString + "’, ‘" + SUMIO + "’, ‘" + OceanRegion + "’, ‘" + Format(CDate(FixTime), “yyyy-MM-ddTHH:mm:ss”) + "’, ‘" + Format(CDate(PCTime), “yyyy-MM-ddTHH:mm:ss”) + "’, " & SQLString & “, '” + Origin + "’, ‘" & MsgType & ",’, ‘" & RPM01 & "’, ‘" & Fuel01 & "’)"
Dim SQLString As String = "INSERT INTO Trails(ID, Name, VLon, VLat, VSpd, VCMG, WGS84Loc) " + “VALUES (99999, ‘99999’, 89.99999, 89.99999, 0, 0,‘POINT(89.99999 89.99999)’)”
ConnectionString = “Integrated Security=SSPI;” + “Initial Catalog=MVMSuiteTest;” + “Data Source=CM\SQLEXPRESS;”
conn.ConnectionString = ConnectionString
cmd = New SqlCommand(SQLString, conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
SQLString = "INSERT INTO Trails(ID, Name, VLon, VLat, VSpd, VCMG, WGS84Loc) " + “VALUES (99999, ‘99999’, -89.99999, -89.99999, 0, 0,‘POINT(-89.99999 -89.99999)’)”
ConnectionString = “Integrated Security=SSPI;” + “Initial Catalog=MVMSuiteTest;” + “Data Source=CM\SQLEXPRESS;”
conn.ConnectionString = ConnectionString
cmd = New SqlCommand(SQLString, conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
End If
’ Zoom to show both points.
Dim tempLayer As MsSql2008FeatureLayer = WinformsMap1.FindFeatureLayer(“TrailLayer”)
tempLayer.Open()
WinformsMap1.CurrentExtent = tempLayer.GetBoundingBox
tempLayer.Close()
WinformsMap1.Refresh()
’ If it fails, zoom to 179.999 and 89.999 instead and see if it still crashes.
End Sub
End Class