Vous êtes sur la page 1sur 4

SPAT1003 Spatial Computations

Spatial Computations Assignment One: SPAT1003


“Every strike brings me closer to the next home run.”
Babe Ruth

Overview

This assignment is in two parts and each part will be submitted separately through the dropbox that
will be made available on Blackboard. Please keep up-to-date with announcements within Blackboard to
ensure that all that is required is submitted at the appropriate time.

Outcomes for the assignment:

Upon successful completion of this assignment you will be able to:

• Analyse a problem and design a solution for it (ULO 1,2,3);

• Use programming skills to implement your design in Python (ULO 2,3,4);

• Construct well structured and documented Python code (ULO 4,5);

• Test and debug your code to produce a robust application (ULO 4,5);

• Present a visualisation of the output from your program (ULO 1,2,3); and

• Present your findings in a structured, professional report (ULO 3).

Background

Today, in the vast majority of fields, data collection is very important and the data collection is closely
linked with location. It is this location aspect which makes the data “Spatial Data.”

In surveying and GIS, there are times where you have part of the location information but not all of it,
especially new unknonwn points. However, from the part that you have (observations in the field and
know coordinates) you are able to derive the coordinates of the unknown points. In this assignment you
will be provided with data that contains a location X0 (x0 , y0 ) and observations, a horizontal distance dh
and a bearing b. From this information you will need to calculate and display the location of the second
point X1 (x1 , y1 ). In the later part of the assignment you will be required to also calculate the height or
z1 value for X1 .

The Overall Tasks

In this assignment you need to develop a program that calculates the location and height of the second
location. Your program will need to be able do the following things:

1. For point X1 calculate its coordinates (x1 , y1 ) using the coordinates of X0 , the bearing b and the
horizontal distance dh ;

Spatial Computations Assignment One Page 1 of 4


Spatial Sciences, School of Earth and Planetary Sciences, Curtin University. CRICOS Provider Code 00301J
SPAT1003 Spatial Computations

2. For point X1 calculate its height difference in comparison to X0 ;

3. Display the data to the user in a meaningful manner; and

4. Visualise the data (to be explained later).

Figure 1: The basic information. blue = known, green = observed, red = unknownto be calculated.

You will not complete all of these tasks in Assignment One.

Assignment One

The assignment is broken down into several tasks. Each tasks flows into the next task. You should com-
plete the assignment task by task. As an example: understand what Task 2 requires; design a solution
for task 2, test that solution; fix any problems found in the solution; code the solution; debug, test and
document it. The following task generally requires the previous task to be completed as you slowly
build up the assignment until it is fully completed.

Task 0

Create a flowchart for the program design to be created. The steps that need to be covered in this flow
chart are Tasks 1 - 4.

Task 1

When your program launches have it display:

• a welcome message;

• a short, meaningful description of what the software system does; and

• a brief how to use it message.

To complete this task define and use the function: welcome_message().

Design the task in pseudocode and implement it in Python.

Spatial Computations Assignment One Page 2 of 4


Spatial Sciences, School of Earth and Planetary Sciences, Curtin University. CRICOS Provider Code 00301J
SPAT1003 Spatial Computations

Task 2

Your program must now ask the user if they wish to continue or if they are finished. If the user has
finished then the program should exit otherwise your program should continue onto the next task.

When completing this task create two messages:

1. the first message tells the user that they chose to continue; and

2. the second message tells the user that they chose to exit.

To complete this task define and use the function: def continue_finish():

Prior to implementing Task 3, the message to the user would be to tell them what they chose to do and
then your program will exit. After implementing task 3 the program will either exit or continue to Task
3.

Design the task in pseudocode and implement it in Python.

Task 3

In this task you will ask the user to enter the following information:

• for point X0 , the x0 coordinate;

• for point X0 , the y0 coordinate; and

• the bearing b from point X0 to point X1 ; and

• the horizontal distance dh between points X0 and X1 .

To complete this task define and use the function: def user_input():

The call to the function will look like this:

x0,y0,bearing,hor_dist = user_input():

Display this information back to the user in a meaningful manner.

Prior to implementing Task 4, the message to the user would be to tell them what they chose to do and
then your program will exit. After implementing task 4 the program will either exit or continue to Task
4.

Design the task in pseudocode and implement it in Python.

Task 4

In this task design, define and implement two functions that:

1. calculate the X coordinate of the second point, from the coordinates X0 (x0 , y0 ), the horizontal dis-
tance dh and the bearing b.

the function returns a double; def calculate_the_X(X0 (x0 ),dh ,b):


The forumla to use: X = x0 + dh · sin(b)

2. calculate the Y coordinate of the second point, from the coordinates Y( x0 , y0 ), the horizontal distance
dh and the bearing b.

Spatial Computations Assignment One Page 3 of 4


Spatial Sciences, School of Earth and Planetary Sciences, Curtin University. CRICOS Provider Code 00301J
SPAT1003 Spatial Computations

the function returns a double; def calculate_the_Y(X0 (y0 ),dh ,b):


The forumla to use: X = y0 + dh · cos(b)

These two functions use the input from the user gathered in Task 3. Display the results to the user in
a meaningful way.

Design the task in pseudocode and implement it in Python.

Things to Note:

As you complete each Task, your program should carry out the new Task as well as all previous Tasks.
After successfully completing each Task, back up your code and begin on the next Task using a copy of
your program code. This way, you have a back up copy of your program that works so in the unlikely
event that you break your code and are unable to restore it to a working piece of software you still have
a working copy of the program.

Your code should be well documented using the 2 types of comments that have been discussed within
this unit: inline comments and block comments.

Assignment 1 Submission Details:

Due Date:
• Check unit outline

Deliverables:

• Signed Student Declaration of Originality of the work;

• The flow chart from Task 0;

• The pseudocode design from Tasks 1 - 4; and

• The Python code from Tasks 1 - 4.

Where to deliver:

• Via the Blackboard Assignment dropbox tool.

Remember to save and back up your work before you log off.

End of Spatial Computations Assignment One!

Spatial Computations Assignment One Page 4 of 4


Spatial Sciences, School of Earth and Planetary Sciences, Curtin University. CRICOS Provider Code 00301J

Vous aimerez peut-être aussi