Projections

Oct 17, 2011 at 5:56 PM

I am getting the following messages(Visual Studio Intermediate Window) when using ProjectionInfo (upon initialzation):

ProjectionInfo.ParseProj4String: command 'to' not supported and the portion of the string after 'to' will not be processed in '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369, 50.0087, 465.658, -0.406857330322398, 0.350732676542563, -1.8703473836068, 4.0812 +no_defs +to +proj=latlong +datum=WGS84 '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '

When my app is running I will get this many many times using this code:

Dim myProj As New DotSpatial.Projections.ProjectedSystems
myList = myProj.GetCategory(ComboBox3.Text).Names.ToList

Any ideas why?

 

Developer
Oct 17, 2011 at 8:07 PM

Can you provide a small sample project? The commands are a result of 

+R_A 

appearing in projection strings (included in the library). When The 

ParseProj4String

method was created, we didn't know what that command was supposed to do.

 

Your code may be interesting because it suggests these objects are reinitialized frequently.

Oct 18, 2011 at 1:29 PM

There are a few instances where this is happening. In my app I populate combo boxes with geographic and projected systems. Reading the systems triggers this.

The message is being shown upon importing of the DotSpatial.Projections:

Imports DotSpatial.Projections

causes:

 ProjectionInfo.ParseProj4String: command 'to' not supported and the portion of the string after 'to' will not be processed in '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369, 50.0087, 465.658, -0.406857330322398, 0.350732676542563, -1.8703473836068, 4.0812 +no_defs +to +proj=latlong +datum=WGS84 '
 ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
 ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
 ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '
 ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '

After that, this code produces the same:

 Dim myProj As New DotSpatial.Projections.ProjectedSystems

 myList = myProj.GetCategory(ComboBox3.Text).Names.ToList

where the line:

 Dim myProj As New DotSpatial.Projections.ProjectedSystems

produces the message repetedly as each projection is shown:

ProjectionInfo.ParseProj4String: command 'to' not supported and the portion of the string after 'to' will not be processed in '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369, 50.0087, 465.658, -0.406857330322398, 0.350732676542563, -1.8703473836068, 4.0812 +no_defs +to +proj=latlong +datum=WGS84 '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'to' not supported and the portion of the string after 'to' will not be processed in '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369, 50.0087, 465.658, -0.406857330322398, 0.350732676542563, -1.8703473836068, 4.0812 +no_defs +to +proj=latlong +datum=WGS84 '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=mill +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '
ProjectionInfo.ParseProj4String: command 'R_A' not understood in '+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs '

 etc . . .

Note that the code:

 Dim myGeo As New DotSpatial.Projections.GeographicSystems

 myList = myGeo.GetCategory(ComboBox3.Text).Names.ToList

does not generate the messages.

Terry

Developer
Oct 19, 2011 at 1:02 AM

When I instantiate the new class (i.e. Dim myProj As New DotSpatial.Projections.ProjectedSystems) I only see the set of messages produced once. An idea why you see it multiple times?

Oct 19, 2011 at 1:52 PM

I was looping through all of the projected systems and then adding them to a combobox.

When the combobox had a SelectedIndexChanged event, another combobox was filled with the categories in the system.

This was done at Form Load so everytime an item was added to the combobox it would trigger the SelectedIndexChange.

I will add a flag to indicate a form loading to prevent this from happening at load time.

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        Try

            '*************************************************
            ' Fill Datum List From Region.
            '*************************************************

            Dim myList As New List(Of String)

            ComboBox2.Items.Clear()

            ComboBox2.BeginUpdate()

            Me.Cursor = Cursors.WaitCursor

            Me.Refresh()

            If RadioButton1.Checked = False Then

                Dim myProj As New ProjectedSystems

                myList = myProj.GetCategory(ComboBox1.Text).Names.ToList

            Else

                Dim myGeo As New GeographicSystems

                myList = myGeo.GetCategory(ComboBox1.Text).Names.ToList

            End If

            For Each myStr As String In myList

                ComboBox2.Items.Add(myStr)

            Next

            Me.Cursor = Cursors.Default

            Try

                ComboBox2.EndUpdate()

            Catch ex As Exception

            End Try

            Try

                ComboBox2.SelectedIndex = 0

            Catch ex As Exception

            End Try

        Catch ex As Exception

            Me.Cursor = Cursors.WaitCursor

            ComboBox2.EndUpdate()

            PromptAsk("An Error Was Encountered For This Selection Because " & ex.Message, "Selection Error", MsgBoxStyle.OkOnly)

        End Try

    End Sub