Difference between revisions of "Traveling Salesman Problem (TSP)"

From CUOSGwiki
Jump to navigationJump to search
Line 33: Line 33:
 
==== '''Import Road file and prepare it for Network Analysis''' ====
 
==== '''Import Road file and prepare it for Network Analysis''' ====
 
'''1.''' You now have three screens open and running under GRASS. A command line black box, a GRASS GIS Layer Manager, and a Map Display pane. In the Layer Manager window click '''File | Import Vector Data |Common Import Formats'''.
 
'''1.''' You now have three screens open and running under GRASS. A command line black box, a GRASS GIS Layer Manager, and a Map Display pane. In the Layer Manager window click '''File | Import Vector Data |Common Import Formats'''.
  +
:'''2.'''
:'''2.''' A GUI window will appear to lead you forward.
 
 
::[[File:g.Region.png|200px]]
 
::[[File:g.Region.png|200px]]
Choose Roadways.shp from the drop down menu and push Run. If you watch the Layer Manager window it will tell you when all is complete. At the bottom of the window you will have to hit the Map Layers tab as you have been watching the command console tab.
+
A GUI window will appear to lead you forward. Choose Roadways.shp from the drop down menu and push Run. If you watch the Layer Manager window it will tell you when all is complete. At the bottom of the window you will have to hit the Map Layers tab as you have been watching the command console tab.
  +
::[[File:tabs.png|200px]]
+
::[[File:tabs.png|200px|thumb]]
 
'''3.''' Now the Roadways.shp file is loaded to the Layer Manager window simply toggle it on to view it in the Map Display window.
 
'''3.''' Now the Roadways.shp file is loaded to the Layer Manager window simply toggle it on to view it in the Map Display window.
   

Revision as of 14:15, 18 December 2012

Introduction

About the Tutorial

If the command line is not working and you don’t wish to take the time to troubleshoot this problem I have been given a great work around from my teacher Scott Mitchell. If you do not have GRASS folders set up refer to step named Getting on our way.

  • 1. Launch the OSGeo4W
  • 2. Type grass64 –gui and then hit enter on the keyboard. (notice there is a space between 64 and the dash)
  • 3. You will see the old GRASS version load, so simply click File from the menu bar and click Quit GIS Manager.
  • 4. Now in the command box type g.gui gui=wxpython&

Installation

Firstly (30-60mins)

Firstly you will need to install free geospatial software. This can be found through the secure and trusted site of Open Source Geospatial Foundation OSGeo4w is Your Open Source Compass for Windows This package provides a set of open source geospatial software for a Win32 environment. Simply follow the directions from this site: Click Here to go to Download Page

QS.png

Next (1-1.5 hrs)

Launching GRASS Tutorial This tutorial will give you a simple walk through of GRASS allowing for an increased understanding of the software, though it is not necessary to complete it in full.


The Tutorial

Getting on our way (just minutes)

NewLocation.png
1. Prior to starting a GRASS session, create a New Folder named Grassdata and a second named nonGrassData. Start GRASS and once the screen opens, browse to the Grassdata folder. Ensure all file and folder names contain NO spaces, that they are short, and do not begin with numbers.
2. Push the button for Georeferenced files, name the newLocation Ottawa and then browse to the nonGrassData folder. Select the Roadways.shp file. Now click define.
3. Click on both Ottawa and then PERMANENT in each of the grey boxes and then push the ENTER GRASS button.

Now we are ready to start working in GRASS.

Import Road file and prepare it for Network Analysis

1. You now have three screens open and running under GRASS. A command line black box, a GRASS GIS Layer Manager, and a Map Display pane. In the Layer Manager window click File | Import Vector Data |Common Import Formats.

2.
G.Region.png

A GUI window will appear to lead you forward. Choose Roadways.shp from the drop down menu and push Run. If you watch the Layer Manager window it will tell you when all is complete. At the bottom of the window you will have to hit the Map Layers tab as you have been watching the command console tab.

Tabs.png

3. Now the Roadways.shp file is loaded to the Layer Manager window simply toggle it on to view it in the Map Display window.

Next do the same for the customers.csv file. Also you must not accept all defaults as you did with Roadways. You must toggel on Override dataset projection. Remember to change the Format to CSV prior to browsing for the file.

Network Preperation

Type this in the command line box, it will adjust the region parameters.

g.region -p vect=HomesRoads

Next clean the data

v.clean input=HomesRoads output=networkIT type= line tool=break,rmdupl

We know that the homes are not located directly on top of the roads so we must calculate and attach them to the network for processing and analysis.

v.distance -p from=GloucesterADD to=networkIT upload=dist column=distance

Next connect the points to the network

v.net input=networkIT output=net points=GloucesterADD operation=connect thresh=166

we can view information about the network

v.category net op=report

Report.png

Data

Go to The city of Ottawa, Open Data Site and download the .csv file Address Points (main) Or click this link. Note: When you unzip this file change its name to customers.csv. While at the same site download the Roadways.shp file too.

Conclusion

Contributions to This Tutorial

About This Tutorial

This tutorial was created for GEOM4008 which is part of the Geomatics program at Carleton University, located in Ottawa, Ontario, Canada.

frame

External Links

Here is a list of links that offer additional support and information;

References

Data

Tutorial http://meta.wikimedia.org/wiki/Meta:Sandbox