A new C++ programming course in action at Moscow University of Geodesy and Cartography
An experimental course of C++ programming for surveyors and cartographers has been developed and implemented in the educational process at Moscow State University of Geodesy and Cartography. The C++ programming course focuses on the use of cartographic tasks and geodetic exercises to illustrate various programming language constructions. One of these training computer programs is discussed. The program computes absolute and relative errors in measuring the lengths of lines associated with the influence of curvature of the Earth. The developed program can be used in the C++ programming course when the topic of “loop instructions” is being examined.
Computer science and programming have become very popular disciplines taught in both high school and universities . Currently, it has now become apparent that significant changes in teaching methods are related to the introduction of new information technologies into the educational process. Computer networks have made distance education a preferable form of learning. Projectors are widely used in lecture classrooms as well as personal computers are part of modern laboratories. This shift to digitalization contributes to changing the way computer science is being taught. Earlier the lecturer had to write down only specific parts of a program on the chalkboard, but these days usage of a computer projector makes it possible to demonstrate the complete program code to the audience. Moreover, the application of demonstration software allows showing the work of the program to the audience in real-time.
Programming for Windows using rapid application development (RAD) has been included in the training process. However, programming for Windows consists of different techniques and methods based on extensive use of RAD. The process of creating the program’s interface involves the selection of relevant components from the toolbar, their further transferring onto the form, as well as defining properties of these components. All of this requires knowledge about various elements of the programming environment. Students are to learn how to operate a programming environment, in other words; which element must be chosen to implement a particular function; how to work with a variety of menus and submenus; which options for typical control elements exist, and how to set these options, etc. An interactive electronic board that allows demonstrating the work with programming environment while developing programs has become a very convenient tool.
Problems in training programming and software design are revealed due to the fact that teaching C++ programming in different educational institutions is being conducted according to similar plans and on the basis of solving the same tasks for all students, regardless of the specializations of students and related fields of activity. As a result, students are not prepared for the current issues in their industry and will obviously face difficulties when they begin to put their knowledge of programming into practice.
Over the past 10 years, the Moscow University of Geodesy and Cartography (MIIGAiK) has been conducting a pedagogical experiment  in teaching students of cartography and geodesy to program in C++ using a specifically developed training course. An important and distinctive feature of this training course from others is the wide use of material on cartography and geodesy for teaching programming. About seventy programs have been developed to train cartographers and geodesy students. All training examples and programs are aimed at solving certain practical problems of cartography and geodesy accessible to junior students. All program development homework is also based on real-world tasks from the field of cartography and geodesy. The examples of geodetic training programs for first–year students might be the following: determination of the height of a point on the map, computation of a grid bearing of a line. For the purpose of training, students are asked to write the program that converts an angle from a radian measure to degrees, minutes, seconds, or estimates Gaussian convergence of meridians. There are programs for the computation of the slope of a line on the map and the computation of declination of the magnetic needle for an old topographic map. During the period of training students also work with programs theodolite and Adrianov’s compass and have to program their tasks.
In this paper, the developed program demonstrates loop instructions for multiple repeating of the same calculations using the example of computing the measurement errors of horizontal and vertical line lengths due to the influence of the Earth curvature. This is a typical problem which the students learn in the course of general geodesy and cartography. The computer program below is intended for cartographers and surveyors who study C++ programming during an introductory course.
Methods of research
To execute this task, the Microsoft Windows 10 operating system was used on a personal computer. We also used the open-source “Code::Blocks” programming environment and the GCC C++ compiler. Let’s dwell on the geodetic statement of the problem. The influence of the Earth curvature on the absolute measurement errors of horizontal and vertical line lengths is well known for surveyors and determined using the following formulae (1,2):
where Δd – the error in determining horizontal length , Δh – the error in determining the vertical length and d the horizontal distance for which this error is calculated, R- the average radius of the Earth (6371.11 km).
In Fig.1 the influence of the curvature of the Earth on the measurements of horizontal and vertical lengths is illustrated. This is only the quick explaining scheme and the sizes of individual portions are distorted for example the radius of the Earth and high of the instrument. The following notation was used in Figure: O is Earth’s center, R is the radius of the Earth, AB is a geodetic instrument for determining length and height of the lines, BE – AC is an error of horizontal line and DE is an error of vertical line due to curvature of the Earth.
The relative error of measuring horizontal line lengths (3) is obtained via the formula (1). The discussed program calculates absolute errors of horizontal and vertical measurements and relative errors for horizontal measurements. The formulae allow estimating the typical dimensions of surface areas on which it is possible not to take into account distortions in the lengths of the lines. The effect of Earth curvature on measurements of distances and elevations is well known and widely used in practice. In the Appendix, we will consider the influence of the curvature of the Moon and Mars on geodetic measurements of the lengths of horizontal and vertical lines.
An example of training program
Figure 2 is the code of the developed program.
Discussions and results
Design and programming for educational purposes should be built on the following important principles: the first is to be thematically oriented for expansion professional skills of students, the second is to be to the maximum extent friendly towards students and the third is to be easily modifiable for student’s experiments.
Let’s scrutinize these principles. The thematically oriented software should be based on the scientific discipline that is the basis for a particular institution. For instance, at the Moscow University of Geodesy and Cartography, the basic disciplines are geodesy and cartography, which students begin to learn from the first year. This makes it possible to develop the training in programming according to the «work in parallel» principle. If programming is taught in the second year, then their students might not have any problems with geodesy and discipline-related knowledge.
User-friendly software should be understandable and readable from the very first start. To achieve this goal several well-proven methods are applied. First, the names of program entities must fully reflect the assignment or purpose of using these entities. For example, the meaningful name magneticAzimuthOfDirection tells the surveyor that this variable contains significantly more than another short or abbreviated name. Secondly, programs should be as short as possible, with no more than 70 lines of code. Since there is a direct link between the amount of code and its readability, the larger the program, the harder it is for the learner to retain the material. And finally, it is required that the program could be changed or modified easily. That means that the program can be independently changed, for example, new functionality to the program could be added to it. Independent computer experiments are extremely useful and therefore training programs should motivate students to deepen their knowledge of programming.
Below there is an example of a guide for the discussed program. This text is put into a methodological guide for students learning the C++ programming language for each training program. The text is provided to each student studying the program. Let’s take a look at this reference material.
In lines, 07- 10 variables are declared. The integer variable d is used for distances, at which the absolute and relative errors in determining horizontal and vertical lengths of lines are calculated. Lines 12 – 14 form the first table with the results of the calculations. The initial value of the loop counter d is 1 km. At each step of the first loop for the counter increases by 1 km and the end of the calculations when d reaches 25 km. In line 18 absolute error of horizontal line length when removed from the initial point is calculated. The relative error of the horizontal length of the line is calculated (line 19), and then in line 20 the variable scale that is the inverse value of the error, is found. The relative errors in the format of the numerical scale of the map are obtained. The result is recorded in the scale variable and displayed on the screen. The scientific notation of a number is used to represent the value of the scale denominator as a rounded integer. Thus, the exact relative error value such as 1:1006880 is recorded in a table in a usable form of 1:1.0e+06 otherwise 1:1000000. When a table is displayed, a setw modifier to set the width of the blank spaces is to be used. For example, setw (5) displays 5 spaces in a row. The results are displayed in line 22, first 5 spaces are printed, then goes the value of variable d, then again 15 spaces are to be typed and the value of the variable absoluteErrorOfDistance with two significant figures are displayed. Next, the value of the relativeErrorOfDistance variable is printed. The first loop ends in line 24 and starting from lines 26-28 the title of the second table is printed, showing the effect of the curvature of the Earth on the absolute error in determining the vertical line lengths. In the second loop for (lines 31 – 35), the counter d takes the initial value of 100 m and changes gradually in increments of 100 m, the loop ends when d reaches 2000 m. This loop calculates the absolute error that is displayed on the screen in the form of a table. As a result, the program displays two tables with errors for horizontal and vertical line lengths respectively.
The results of computing made by the program are presented in tables 1 and 2 below. The errors of the measurements of the lengths of the lines are shown in the tables for greater visibility and the relative error is presented in the format of the numerical scale of the map. Some data has been omitted to reduce table size. In this case, the cells of tables contain the special symbol as three dots (…).
Consider the results of the computations presented in Tables 1 and 2. These results should be familiar to cartographer and surveyor students. But if this is not the case, the results printed by the program will help students to remember important items of geodesy and cartography. The highest accuracy of geodetic measurements on the Earth, equal to 1:1000000, is achieved by measuring horizontal lengths of lines at distances not exceeding 11 km. In such surface circle areas, the influence of the Earth curvature on the measurement of horizontal distances can be ignored. In geodetic measurements with the error of 1:200000, it is possible to neglect the curvature of the Earth at distances of about 25 km. Table 2 shows measurement errors in determining vertical line lengths due to the influence of the curvature of the Earth. Let see the obtained errors. An absolute error of height equal to 1 mm corresponds to a distance on the ground of about 113 m. At a distance of 1 km, this error reaches 7.8 cm. Thus, when the students are studying C++ programming, they are surrounded by the exercises of cartography and geodesy and learn to apply programming to solve their specific cartographic and thematic geodesy problems.
At the Moscow University of Geodesy and Cartography, a new approach to teaching C++ programming for students specializing in cartography and geodesy was developed. Methods of implementing the educational process aimed at improving the effectiveness of teaching programming in training groups of cartographers and surveyors are considered. The new C++ programming course is geared towards the needs of the surveying and cartographic industry. This is the request of today to create programming courses suitable for particular higher education institutions taking into account their scientific specialization. A training program for cartographers and surveyors studying the basics of C++ programming has been developed. The program computes the distortions that occur when measuring horizontal and vertical line lengths associated with the curvature of the Earth. Using the program, the typical dimensions of surface areas were obtained, which can be conditionally considered flat with an accuracy of 1: 1000000 and 1: 200000. The program can be used as training material in the C++ programming course to illustrate the loop instructions. The program code is described in detail and the purpose of the instructions used is explained.
Siddhartha Rao (2012) SAMS Teach Yourself C++ in one hour a day. SAMS, USA.
Zablotskii V.R. (2021) Ten-Years Pedagogical Experiment at Moscow University of Geodesy and Cartography: C++ Programming Course Tailored for Surveying Students. FIG e-Working Week 2021, Commission: 02.2 – Innovation in Professional Education during COVID-19, 21 – 25 June 2021.https:// www.fig.net/resources/proceedings/ fig_proceedings/fig2021/papers/ ts02.2/TS02.2_zablotskii_10883.pdf
It is interesting to apply the discussed program to assess the influence of the curvature of other celestial bodies on the measurements of horizontal and vertical lines. Let’s try to use the program to compute the influence of the curvature of the Moon and Mars. To do this, take the average radius of the Moon equal to 1,738 km and the average radius of Mars equal to 3,396 km. The computation results can be formulated as follows. The radius of the site approximated by plane surface (with the accuracy of measurements of 1:100,0000) on Mars is just under 6 km, and on the Moon reaches only 3 km. In geodetic measurements with the error of 1:200,000, it is possible to neglect the curvature of Mars at distances no more than 13 km, and for the Moon, such a limiting distance is 6 km. Computations show that on the surface of Mars an error in determining the vertical line length equal to 1 mm is achieved at a distance of 83 m. On Mars, this error increases to 14.7 cm at a distance of 1 km. On the Moon, the error in determining the vertical length of a line in 1 mm corresponds to a distance of 63 m and at a distance of 1 km the error increases to 28.8 cm.