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

  What are the advantages of this architecture

Reduced instruction set computers provide a large number of general-purpose registers and very few memory access instructions. Most instructions use registers instead of memory. What are the benefits of such architecture? Can you think of a disadv..

  Write down the values of total1 and total2

Write down a program that asks the user to enter two positive floating point numbers and after checking their validity it prints them in fixed point notation with the width of ten and with two digits to the right of the decimal point.

  Write a program to apply combination of transformation

Write a program to apply combination of transformation, rotation, reflection and shearing) on the following objects.

  Write a program called a2p1 to run in the lc-3 simulator

Write a program called A2P1 to run in the LC-3 simulator. The program asks for the user to type in his or her UPI. Then the program asks for the age of the user and prints the UPI out that many times.

  Explain analog signal conditioning

Analog Signal Conditioning, An LVDT with associated signal conditioning will be used to measure work-piece motion from -20 to +20 cm. The static transfer function is 2.5 mV/mm. The output will be interfaced to a computer via an ADC.

  Define how referential integrity actions can be used

explain the default rules for enforcing referential integrity constraints. Explain how referential integrity actions can be used to override the default referential integrity constraints.

  You can easily and quickly deploy applications via a gui

1.you can easily and quickly deploy applications via a gui interface and push via a browser. historically many

  Make a memo which lists and in brief explains the main

as manager of networks and computing operations for fashion land a retailer of womens clothing and accessories you have

  Investigate and describe how data is structured stored and

there are six problems that can be minimized by using the database approachdata redundancydata isolationdata

  Effects of technology

Select a new technology that interests you and analyze it from the sociological point of view. What do you consider this technology would contribute towards the society?

  Assume that the cross section of each strand

A regional telephone company has 10 million subscribers. Each of their telephones is connected to a central office by a copper twisted pair. The average length of these twisted pairs is 10 km. How much is the copper in the local loops worth.

  Write down a 3- to 5-page paper which includes the

write a 3- to 5-page paper that includes the following based on your chosen virtual organizationq1. explain the

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