Geographic information system for storing point data

Assignment Help Computer Engineering
Reference no: EM13762636

Background

For this project you will build a simple Geographic Information System for storing point data. The focus is organizing city records into a database for fast search. For each city you will store the name and its location (X and Y coordinates). Searches can be by either name or location. Thus, your project will actually implement two trees: you will implement a Binary Search Tree to support searches by name, and you will implement a variation on the PR Quadtree to support searches by position.

Consider what happens if you store the city records using a linked list. The cost of key operations (Insert, remove, search' using this representation would be Θ(n) where n is the numbs of cities. For a few records this is acceptable, but for a large number of records this becomes too slow. Some other representation is needed that makes these operations much faster. In this project, you will implement a variation on one such representation, known as a PR Quadtree. A binary search tree gives O(log n) performance for insert, remove, and search operations Of you Ignore the possibility that it h unbalanced). This would allow you to insert and remove cities, and locate them by name. However, the BST does not help when doing a search by coordinate. In particular, the primary search operation that we are concerned with in this project is a form of range query called "regionsearch." In a regionsearch, we want to find all cities that are within a certain distance of a query point.

You could combine the (x. y) coordinates into a single key and store cities using this key in a second BST. That would allow search by coordinate, but does nothing to help regionsearch. The problem is that the BST only works well for one-dimensional keys, while a coordinate Is a two-dimensional key. To solve these problems, you will implement a variant of the PR Quadtree. The PR Quadtree Is one of many hierarchical data structures commonly used to store data such as city coordinates. It allows for efficient insertion, removal, and regionsearch queries. You should pay particular attention to the discussion regarding parameter passing in recursive functions.

Extra two points implement a Quadtree in which the leaf nodes will store up to three points.

Invocation and I/O Files:

Your program must be named PRprog and should be invoked as: PRprog <filename>, where <filename> is a command line argument for the name of the command file. Your program should write to standard output (System.out). The program should terminate when it reads the end of file mark from the Input file. The Input for this project will consist of a series of commands (some with associated parameters, separated by spaces), one command foe each tine. Commands are free format In that an arbitrary number of additional spaces may be interspersed between parameters. The Mimi file may also contain blank lines, which your program should ignore. Each Input command should result in meaningful feedback in terms of an output message. In addition, some Indication of success or error should be reported. Some of the command specifications below indicate particular additional Information that Is to be output Commands and their syntax are as follows. Note that a name is defined to be a string containing only upper and lower case letters and the underscore character,

insert x y name:

A city at coordinate (x y) with name is entered into the database. That means you will stow the city record once In the BST, and once In the PR Quadtree. Spatially, the database should be viewed as a square whose origin

Is in the upper left (NorthWest) corner at position (0, 0). The world is 234 by 214 units wide, and so x and y are integers in the range 0 to 214 -1. The x - coordinate increases to the right, the y-coordinate increases going down. Note that it is an error to insert two cities with identical coordinates, but not an error to insert two cities with identical names.

remove xy:

The city with coordinate (x y) is removed from the database (If it exists). That means it must be removed from both the PR Quadtree and the BST. Be sure to prim the name and coordinates of the city that Is removed.

remove name:

Acity with name is removed from the database (If any exists). That means it must be removed from both the PR Quadtree and the BST. Be sure to prim the name and coordinates of the city that is removed.

find name:

Print the name and coordinates from all city records with name. You would search the BST for this Information.

search xy radius:

All cities within radius distance from location (x y) are listed. A city that is exactly radius distance from the query point should be listed x and y are (signed) Integers with absolute value less than 214 radius is a non-negative integer.

debug:

Print a listing of the PR Quadtree nodes in preorder. PR Quadtree children will appear in the order NW, NE, SW, SE. The node listing should appear as a single string (without internal newline characters or spaces) as follows:

• For an internal node, print "I".
• For an empty leaf node, print "E".
• For a leaf node containing on or more data points, for each data point print X, Y, NAME where X is the x-coordinate, Y is the y-coordinate, and NAME is the city name. After at of the city records for that node have been printed, print a 'bar" or "pipe symbol (the | character).

The tree corresponding to the following Figure would be printed as: |40,45||15,70B||70,10C|E69,50D|EIEEEEE55,80E|80,90F|.

960_pr.png

Requirements

Environment: Make sure your program is able to work on T-lab machine. (Note the version of compiler: g++ (GCC)
4.4.7 20120313 (Red Hat4.4.7-3))

Program:

Your code should he well commented and explain what you are doing. Make sure your runs correctly, efficiently.

Reference no: EM13762636

Questions Cloud

What is shakespeare telling his audience about women : What is Shakespeare telling his audience about women through these characters? How might Queen Elizabeth have reacted to Shakespeare's view of women?
Difference between manual accounting-computerized accounting : You have just completed training for your new position in a large accounting firm. The trainer has covered the difference between manual accounting and computerized accounting.
Purpose of the reconciliation of taxable income : What is the purpose of the reconciliation of taxable income with book income? Identify and briefly describe the seven types of corporate reorganization.
Discuss the current economic situation : Discuss the current economic situation in the U.S. as compared to five (5) years ago. Include interest rates, inflation, and unemployment rate in your explanation.
Geographic information system for storing point data : For this project you will build a simple Geographic Information System for storing point data. The focus is organizing city records into a database for fast search. For each city you will store the name and its location (X and Y coordinates). Sear..
Accounting methods and inventories : Create a corporate policy designed to minimize inventory shrinkage related to theft, stocking errors, shipping errors, etc., indicating how the policy will be enforced and procedures that may need to be implemented.
Practice of charging businesses to use skype : Determine whether or not it would be beneficial for Microsoft to charge businesses for the use of Skype. Provide a rationale for your response.
Write critique of womens literature : Write Critique of Women's Literature. It is common for people to critique literature, especially when it presents new thoughts and ideas.
Prepare journal entries of nike : Nike, Inc., with headquarters in Beaverton, Oregon, is one of the world's leading manufacturers of athletic shoes and sports apparel. The following activities occurred during a recent year. The amounts are rounded to millions.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Impact of computer on people and organizations

Impact of computer on people and organizations

  Give html code and an external css file

An ordered list below the image setting out your personal priorities in taking this degree course. salect an option that is different from lower Roman.

  Question1 while running snort ids why may there be no

question1 while running snort ids why may there be no alerts?2 if we only went to a few web sites why are there so many

  To further investigate this weeks topics and to explain

to further investigate this weeks topics and to demonstrate your understanding of e-commerce as it relates to business

  Make a class named pay that includes five double variables

make a class named Pay that includes five double variables.

  Methods to target certain audience

Recognize a particular website which you frequently go to and explain the targeted audience which visit that particular site. Provide explanation how the site is developed for its certain target audience.

  Define the best possible scenario for an organization

If in a hypothetical situation your company was capable to hire only either technically sound managers with weak leadership skills OR strong leaders with less knowledge/interest in routine management, that would you opt for and why.

  Design a class street that includes a number

Design a class Street that includes a number

  Questiona a gui might contain text-fields buttons and other

questiona a gui might contain text-fields buttons and other labels. a button frequently triggers an event on the gui.

  Write a grammar for the language consisting of strings

Write a grammar for the language consisting of strings that have n copies of the letter a followed by the same number of copies of the letter b where n > 0. For example strings ab, aaaabbbb, are in the language but a abb, ba, aaabb are not.

  How are workflow, an artifact, and a baseline related

How are workflow, an artifact, and a baseline related - Can you explain how workflow and baseline related are?

  What types on a lan and the type of software licensing

Discuss role of each of the following server types on a LAN and the type of software licensing with which the software should be purchased.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd