Professional Documents
Culture Documents
1 Problem Description
You work for Elephant-Package, a delivery service. Unlike normal delivery services, you only have one package you must
deliver (and its HUGE). Your job is as follows:
* Your boss demands to see which routes you take during any delivery excursion. So you always create an images for him
which highlight the routes you took.
In order to get this automated, you wrote a driver program using some API code your co-worker wrote. Unfortunately,
today, the hard-drive containing all the API code (and your program) died and there are no back-ups. Your co-worker is also
sick and your boss is getting impatient not seeing the routes you took. Your immediate goal at the moment is to rewrite the
API your co-worker wrote, to the best of your knowledge. You remember the following:
2.1 Clarifications
To be clear, a node is just a point on a map. A point could represent a stop sign, house, or even a point along a path (an
abstract concept; not physical). A way is just an ordered list of node ids. Ways determine all graph edges. More precisely,
two nodes are connected by an edge if they appear on adjacent lines within the text of a way, within an osm file. This project
is concerned with only those ways which are labeled as highways. .
2.2 Node
You’ll create a Node class which inherits from class Point2D. Point2D class (as usual) handles a point in 2D Euclidian
space. class Node is a specialization such that it handles both latitude and longitude and also contains the corresponding
node-id in the OSM file. The following is an example OSM node element where the id of the node is “675564556”:
<node id="675564556" visible="true" version="1" changeset="4244425" timestamp="2010-03-27T08:36:46Z"
user="NE2" uid="207745" lat="30.4790515" lon="-84.2339978"/>
1
2.3 Highways
Every highway in the OSM file is an ordered list of nodes within way tags. OSM identifies any highway with a tag containing
the key “highway”. A highway is any road, route, way, or thoroughfare on land which connects one location to another and
has been paved or otherwise improved to allow travel by some conveyance, including motorized vehicles, cyclists, pedestrians,
horse riders, and others. For more information on highways, visit the OpenStreetMap wiki.1 The following is an example of
a highway:
<way id="11059926" visible="true" version="2" changeset="14392844"
timestamp="2012-12-24T17:02:03Z" user="bot-mode" uid="451693">
<nd ref="98549913"/>
<nd ref="98638407"/>
<nd ref="98638410"/>
<nd ref="98638411"/>
<nd ref="98638413"/>
<nd ref="98638415"/>
<nd ref="98638416"/>
<nd ref="98638418"/>
<nd ref="98638419"/>
<nd ref="98638421"/>
<nd ref="98638423"/>
<nd ref="98638425"/>
<nd ref="98638428"/>
<tag k="highway" v="residential"/>
<tag k="name" v="Pine Ridge Road"/>
<tag k="tiger:cfcc" v="A41"/>
<tag k="tiger:county" v="Leon, FL"/>
<tag k="tiger:name_base" v="Pine Ridge"/>
<tag k="tiger:name_type" v="Rd"/>
<tag k="tiger:zip_left" v="32308"/>
</way>
In the above, <tag k="highway" v="residential"/> has k="highway" which determines that the way is a highway. Twelves
edges are also given, going from one node to the next, within the text above.
2
An OSM node has a latitude and a longitude along with an id. They are provided so that when you draw a node in an
image, you know the position it should be drawn at. In this case, since you are drawing the highway network, you need to
draw the edges connecting nodes in a way.
The bounding latitudes and longitudes for the OSM data are provided in the bounds xml datum, usually located at the
top of the file. Since both latitude and longitude have a fractional part of 7 decimal places, it’s not feasible to draw one pixel
per unique coordinate possible. However, since we have the OSM data for only a single city, the difference in the decimal
values is small. Find the maximal number of decimal points that differ between the bounding latitudes and between the
bounding longitudes and then determine a scaling factor such that the image is no larger than 5,000x5,000 pixels. Adjust
the image to account for aspect ratio.
The gray scale image will have the following coloring scheme:
• Background = 255
./maps
FSUStadium.osm
98565457
667207015
1404392390
The first line is the osm file that will be read. Your program should read it from the osm directory. The next three lines gives
the node ids for the headquarters, pickup, and drop-off nodes. Your program should not cout any information. It should
write a pgm map with all the routes taken.
You can try yet another sample program run:
./maps
WescottFountain.osm
1407975682
1407984386
2689709258
7 ABET Assessment
This course is one of the Computer Science department courses designated for assessing certain student outcomes, required
by SMALC/SACS and ABET for accreditation purposes. This assessment will be done with 2 different programming as-
signments in the course, designated as such because they will incorporate multiple aspects of programming skills learned to
date. They will be scored in several areas on a scale of values including ”Ineffective”, ”Effective”, and ”Highly Effective”.
Each student must achieve an overall score of ”Effective” or higher (Earning 70% of available assignment points will count
as ”Effective”) on at least ONE of the two designated assignments.
• Given the existing implementatiom of class OSM, student will be able to modify it to suit the problem needs.
A score of 70 will satisfy the ABET requirement for this assignment.
A Point2D class header file is provided. Please make a separate Point2D cpp file. Also make a separate Node class which
must inherit from the Point2D class. Also make separate node.cpp and node.hpp files.
3
8 Grading Rubric
This project is worth two homework assignments for a total of 200 points. The grading for this project is split into three
parts. All three parts are related to the Osm class which must be modified and should ideally be completed in the following
order:
1. Parsing an OSM file and storing the relevant data.
– (20 pts.) Wrote classes to represent the OSM elements needed by the revised Osm class.
– (5 pts.) Parsed the bounding latitudes and longitudes.
– (15 pts.) nodes parsed and stored appropriately.
– (20 pts.) ways parsed and stored appropriately.
• (20 pts.) Implemented a pathfinding algorithm that uses the data structures (e.g. adjacency list, breadth-first search,
and all that is required for the algorithm).
• (10 pts.) Derived an inherited Node class which is used in the highway network.
8.4 Penalties
• Fails to compile after fixing two compiler errors. (-200 pts.)
• Putting more than the necessary source files in the repository. Empty directories may be needed. (-200 pts.)
4
10 Hints
This project tests the following:
• Critical Thinking
– What members should the new modified Osm class have?
– If the highway network is just a set of nodes and edges (i.e. a graph), which data structure should you choose to
implement (see the course slides Structuring Data)?
– How do you fill up the data structure given the data you parse from an OSM file (this is reliant on how you
implement your member data)?
• Time Management
– This project is long and will require lots of thinking. If you start on the last day, or even the last week, you might
fail. Start early. Commit often.
• Code Reuse
– The Osm class from Project 5 will be reused and slightly modified. Please store all related files with the name
“osm rev” (e.g. osm rev.cpp, osm rev.hpp, osm rev.o).
– The Matrix class from Project 6 will be reused and slightly modified. It has been provided to you. Please store
all related files with the name “matrix rev” (e.g. matrix rev.cpp, matrix rev.hpp, matrix rev.o).
• Inheritance
12 Helpful Links
• Graphs as Adjacency list, http://www.algolist.net/Data_structures/Graph/Internal_representation
• Breadth First Search, https://en.wikipedia.org/wiki/Breadth-first_search