Business GIS at WCU Header

Geo325: Business Geographics
Lesson 2 ~ Geocoding in MapInfo

Lesson Overview: In this lesson you learn very powerful and important GIS skill--geocoding. Geocoding allows us to take a simple table containing street addresses, find each address and create a point at that location. You will load a file containing Chester County businesses into MapInfo. You will geocode the business locations and then create a map showing their locations in Chester County. You will also create a new layout from start to finish, developing your presentation skills. Before we start though, we need some basics of Windows.

Part 1. Navigating Windows, Organizing Your Files and Saving Your Work

Working With Your Flash Drive

The advantage of a flash drive (also called a thumb drive) is that you can take all your work with you when you go. If you have to come back to complete a lesson, you'll have all the files you need with you on your flash drive.

Insert your flash drive into one of the USB ports on the front or back of the computer. After a few seconds, the computer will recognize it and assign it a drive letter, often E: or F:. The process is not fail-safe; if you have any trouble with this step ask a lab assistant for help.

Navigating Windows and Organizing Your Work

We will now create a new folder on your storage disk for Geo325, and then a new subfolder for Lesson2. We recommend you create a new folder each week for that week's lesson (eg Lesson2, Lesson3, etc). To create a new folder on your storage disk:

The biggest hazard with the flash drive is accidentally leaving it somewhere. Periodically copy the files from your flash drive to a backup location, such as your personal computer. The files used in this class are also fairly small; you can also email them to yourself as a backup.

Connecting to A Network Computer

For this class we have shared the GIS datasets by placing them on a network computer. You will download them from the network location and save them on your flash drive. Here's how to find them on the network.

Click on the Windows start button and then select My Computer. 

Once the "My Computer" dialog opens up, type \\Geographia in the Address area and then hit the Enter button on your keyboard. Make sure you use the 'forward-slash' \\. See image following.

 This

This step directs your computer to find the computer on the network that has the name Geographia.

You will now be asked to provide credentials to be allowed on this computer. Type your WCU email address (e.g., EB123456@wcupa.edu). Then enter your password. You should then be able to see folders on our GIS server, Geographia, similar to the following image:

 

Mapping A Folder to a Drive

Now we will map a folder on Geographia to a network drive. This will make is so that your local computer can directly access files on Geographia just like it could your flash drive, or its own local hard drive or floppy disk. Click once on the folder named Work. Now right-click on that folder. Select the option to map a network drive.

Map the folder on Geographia named Work as the W: drive. Always map it the same way so it's easy to remember. Also, during this class you will be creating GIS files that are saved on your flash drive but which call up files on Geographia. It will look for them on W:. That's why you should always map the drive as W:

You now have gained some great computer skills: finding a computer by name on a network, and mapping a network drive.

 

Part 2. Launch MapInfo and Add Some Layers

Open MapInfo by double clicking on the MapInfo icon on the desktop. If a Quick Start window opens, dismiss it by selecting Cancel. Now would be a good time to fit this lesson and your MapInfo application so you can see both at once. On the blue bar at the bottom of your screen, right-click and then select Tile Windows Vertically.

Let's add a data layer. On the File Menu select Open a Table and click open. Navigate to W:\Geo325\Data\SpatialData\Chesco\ and click on STREETS.TAB. We have just added a new layer to our workspace. It contains the streets and roads of Chester County. The streets layer has the information needed to create a point from a street address.

Maximize your map window by selecting the middle of the 3 windows buttons in the upper right corner of your map window  . This will make your map area as large as possible. Using any of the techniques you learned in Lesson 1, zoom all the way out so you can see all of Chester County streets.

Let's add some more layers. Click on File > Open. In the same folder as STREETS.TAB, you'll see URBAN.TAB. Click on URBAN.TAB and select Open. This will add the more densely populated areas of Chester County to your map. They will appear in yellow.

We will now decide what business locations we'd like to geocode so we can include them on our map. Minimize your MapInfo application (left button of ). We need to get a business location file and copy it to our flash drive.

Open My Computer (on the start menu or on the desktop) and then navigate to W:\Geo325\Data\AttributeData\. You'll see a list of files there with the extension ".dbf." They include things like banks, restaurants, golf courses, supermarkets and many others. The file names explain what sort of businesses are stored in each file. Choose one that is interesting to you. Copy one of these files to your flash drive. To copy a file, select it by clicking once on it. On the window menu select Edit > Copy. Now navigate to the folder you created on your storage disk. On the menu, select Edit > Paste.

Now go back to MapInfo. Maximize the MapInfo application. Click on File > Open. In the Look in box select your storage disk, whether that is E: or F:. You will have to change the 'Files of Type' drop-down to dBASE (.dbf). Once you change to *.dbf format, your business location file should appear in the window. Click on the name of your file and then click Open. At the dialog window that pops up, accept the default File Character Set and click OK.



Part 3. Geocoding

Step 1. Automatic Geocoding

We will begin the geocoding process in Automatic Mode. In Automatic Mode, MapInfo will process the entire business file and match every entry that it can without any interaction with us.

Click on Table > Geocode on the MapInfo menu. This opens a Geocoding box. Note that the Mode is selected as Automatic. For Geocode Table, click the drop-down and select your business location file. For using Column, select Address. For Search Table, select STREETS.

Click on the star or box to the right of "Symbol." We need to set a color and size for the symbol that will show our geocoded business locations. Increase the size of the symbol by selecting a larger size for the font (maybe 18?) and then select a bright color that will stand out against your roads and other layers. Choose a different symbol if you like, maybe a square or triangle. Click Ok when you have the symbol the way you like.

Click OK in the geocode window. MapInfo will now try to geocode all your business locations without any input from you. When it is done, it will report to you how many of the entries matched.

Step 2. Interactive Geocoding.

Businesses generally want as many locations mapped as possible. Geocoding standards of 95-99% are not unusual. We will not achieve that standard for this class but you will get a chance to see where mismatches come from and how to correct some of them.

Unmatched entries will arise from two sources.  If your business database has a lot of address errors, such as mispelled street names, missing house numbers, or outdated information, that will produce errors. The second possible source for a failure to match is that the streets layer you are using to geocode the addresses is poor quality. Perhaps street names are wrong, or the street number system is not valid, or the address ranges are incorrect. All of these can contribute to unmatched address.

We will now take the additional step of geocoding in Interactive Mode, to try to increase the number of matched addresses. That is, Mapinfo will show you as it goes and give you a chance to help the process. Let's go through the process, to see how it works.

Click on Table > Geocode again. In the geocode window set the mode to Interactive instead of Automatic. Click OK.

The interactive geocoding process will step you through each business location that it could not find an address for. For each business location it could not find, it will show you the address (from the database) it is looking for, and the closest match it can find in the streets layer. You'll review each suggestion and either accept that match (by clicking on Ok), choose a different item from a list of possibilities and accept that item, or reject any suggestion and leave the entry not matched (by clicking on Ignore.)

Again, the geocoding process fails for different reasons, related either to the business address file or the streets geocoding later. Sometimes the problem is spelling. For example, a street name is Reservoir Road but your database misspells it as Resevoir Road. The problem can also be that a address number cannot be matched. For example a business address might be listed as 267 S Whitford Road and the roads layer only has numbers 400-499. You'll have to use judgement to determine whether the addresses match closely enough.

EXAMPLES

Add Your New Geocode Layer to the Map.  Once you have business locations geocoded to an acceptable level, you'll add them to your map as a layer. Open your map window, using the skills you learned in Lesson #1. Open the layer control too.l.


Click the Layers ~ Add button in the lower left, then select (click on) your business file name and then select Add. Click Ok. Click OK. You should now see points on your map that represent the locations of your businesses. You have successfully geocoded!

If you don't like the symbol you chose, maybe the color is not bright enough or it's too small, you can change it now. Select Layer Control. Double click on your business location layer. Check the box for Style Override and then redefine how you want your locations drawn.

Labelling Features

Behind the Scene with the Label Tool

 Here's are the actual steps that the label tool has to perform.

If a map layer has information in it, such as the name of the business, we can label the point on the map with that information. Let's label a few of the businesses with their name.

Select the label tool (   ) on the Main Toolbar.  Click on one of the business location points on your map. A label should appear.

After you place the label, you might have to drag it away from the 'busyness' of the roads. Select the label and move it away. MapInfo automatically adds a line that will point from the text to the point feature.

 

Step 3. Creating A Layout

In this section you will create a layout, suitable for printing. A layout can include a map (or maps), as well as other objects like a title, your name, a legend, a north arrow, 'neatlines' drawn around objects and other helpful things.

Create A New Layout.

To create a new layout, click on Window on the menu bar, then New Layout Window. On the dialog that opens, select the "One Frame..." option, then click OK.

Resize and Reposition The Map Frame

You now have a map frame on your layout. A frame is just a way of saying, "draw something from somewhere else." A map frame is a container object that holds a map. The frame defines where on the page that map is drawn and how large it should be. A map frame is dynamic, that is, if you inserted a map frame, and then went back to your map and zoomed in, the frame on your layout would also be zoomed in. Likewise if you were to turn layers off in your map, they would no longer be visible on the layout.

Before moving on, make sure your layout is in the "landscape" orientation, that is, it should be wider than it is tall. If it appears in "portrait", select File, Page Setup, and under Orientation, select Landscape.

Now resize the map frame on your layout. Most often you want the map to be as large as possible on the page so you get the greatest detail possible. Make the Select pointer active by clicking the pointer in the Main Toolbar.   . Click on the map to select it. It will change to a red hatch pattern to indicate that you have it selected. Click on and hold one of  the small black squares at the corners of your map area. Drag the lower right corner of the map to the lower right corner of the white area on the layout. Stay inside the gray border; anything outside this border will get clipped off when you print it. Release the mouse. Now do the same with the upper left corner of the map, dragging it to the upper left section of white. The map frame should now nicely fill your layout.

Set Your Map Scale and Create a Scale Bar

Setting the map scale is an important part of making your message clear. Here's what we are aiming for.

The scale should be a nice whole, well-rounded number, that is 1" = 2 miles, or 1" = 2000 feet, or 1"=10 kilometers, for example. Not 1" = 1.732 miles, or 1" = 1853.2 feet. That is sloppy cartography!

To set the map scale, double click on the map frame. In the dialog box, set the scale to 1 in = 6 miles. It's ok if it's just a smidge different, as shown below (6.004). Close the dialog box. Look at your map and make sure that all your data on the map still shows in the frame. Experiment by doing this again, select 1" = 5 miles, 1" = 4 miles, and other options. See how that changes the data.

The scale we select should result in a map that fills as much of the paper as we can, but does not cut off any of our features.

Finally, when we add the graphic scale bar, people should be able to quickly comprehend it.

 

Now we can create the scale bar.

Here's the style of scale bar that MapInfo uses. It's a fairly common format.

This scale bar has two major divisions. The left half is further divided into two subdivisions. The middle number (i.e., "6") represents the scale. The width of the scale bar from the "0" to the "6" should be exactly one inch on your paper. So, the width of the total scale bar would two inches long and represent 12 miles. Let's go back to the map and create a scale bar that is a total of 12 miles long.

Go back to your map window. Remember how to get there? (On the menu, select Window. Find your map window in the list). Select the scale bar tool     on the tool bar. Now click on the map where you want the lower left corner of the scale bar to appear. Put the scale bar whereever you like, maybe in the lower left corner of the map. Avoid the lower right corner as we will be putting other text there. For the length of scale bar, use 12 miles. Click OK. A scale-bar will appear on your map.

Now go back to your layout. You now have a scale bar on your layout that is exactly two inches long! You can print it out and measure it if you like. One inch of the paper equates to 6 miles on the map, and the graphic scale is correctly sized to that one inch. That is nice cartography!

In the computer age it is quite easy to slap a scale bar on your printout. Having it actually be correct, true and helpful to the reader is a skill that will set you apart from many computer cartographers.

The mechanics will vary from one program to another. You should always start, however, by determining what scale you want your map to be. Play around with the map scale and find that magical number that fills the paper but is still nicely rounded. Then create a scale bar that is consistent with your scale. Don't just accept the default scale and the default scale bar size that the program gives you. You might end up with a scale bar that is 1.32" inches long and says 1" = 4312.21 feet!

Finalize the Map

We will now add graphics and text to our map so the reader knows what it's all about.

Add A North Arrow

To add a north arrow, we will simply place a point on the layout. We will then change the style used to draw the point to some built-in north arrows provide by MapInfo.

Select the pushpin on the drawing toolbar. Now click somewhere on your layout approximately where you'd like the north arrow. You just added an ordinary dot symbol. Let's change it now to be a north arrow. Use your select tool (solid black arrow). Select the point you just added to your layout. It might already be selected. Now click on the "Marker Style" tool on your drawing toolbar. It looks like this: . In the Font drop-down, find the MapInfo Arrows option. Then under Symbol, find a north arrow you like. You probably want to increase the size of the font as well, to make it more readable. Black is a good color for a north arrow.

Add A Legend.

All maps should have a legend. Adding a legend in MapInfo is a two-step process. First we will create the legend. Then we will place it on the layout.

Create the Legend.  To create a Legend, click on Map > Create Legend on the menu. This will take you through the steps to create the legend.

Let's remove STREETS and URBAN from appearing in the legend. The roads and urban areas are fairly self-explanatory on the map so we'll assume our reader knows what they are. Remove them from appearing in the legend frame by clicking on their names and selecting Remove. The Legend Frames side should have only your business location layer in it. Click Next. Click Next. Click Finish.

Now fine-tune your legend. Double-click on the text in the legend window. Always make sure the wording on a legend is user-friendly English, and not "computereze." For example, change a layer name from 'shoesretail' to Retail Shoe Stores. Change pizza_shops to Pizza Shops. Change banks to Banks.

Click Ok or finish until the Legend is completed. The legend is now ready to be placed on a layout.

Place the Legend. Go back to your layout. (Click Window on the menu and then select your layout in the list at the bottom) We will now add a new frame to your layout, but this time it will hold your Legend. Select the frame tool. (See image, right). Click anywhere on your layout. Mapinfo will then prompt you for which window to show in this frame. Click on the one that says Legend of ....

Remember. A frame says what to draw (your map, your legend, a table, etc.), how big it should be to draw it, and where it should be placed on your page.

Resize your legend frame as you did for your map frame. The frame should just fit nicely around its contents. Move the legend frame to the lower right portion of your layout, just above the scalebar.

Mostly we will have just two frames on our layouts: the map frame and a legend frame. But sometimes you want more than one map to appear on the same layout. Or you might want to show a table, or a picture also. We will work with multiple frames in the next exercise.

If it turns out your scale bar is not positioned well on your layout, you'll need to move it. To move the scale bar, go back to your map window. (Under Window, look at the list of windows in the project and find the one that is your map. For this exercise it is probably titled STREETS, URBAN Map. It will definitely have the word Map in it. Click on the name to open this window.) Now on the menu, select Map, Clear Cosmetic Layer. Confirm that you do want to clear cosmetic layer objects. Now add the scale bar again, in a new position, by using the scalebar tool   (). When you have it where you like it, go back to your layout. (Under Window, find the window with Layout in its name.)

We will now use the drawing toolbar to add text, lines, rectangles, etc, to our map. The drawing toolbar looks like the image at the right. You can put your cursor over each of tools and hold it there; words will appear that show what each tool does.

Add Explanatory Text

Add A Title to your map layout. First select the style for the text to appear in. Click on the Text Style   button on the Drawing tool bar. Set the point size to 24 and mark Bold. Click Ok. Now select the Text tool on the Drawing Tool Bar, click on the map where you wish to begin your title (upper center of the map, inside the white area), type a name for your map, such as " Chester County." If you want to reposition the title after you have placed it, select the select pointer   , click on the text in your map, and then hold and drag to move your title. If you need to change what the text says, double click it and a dialog will open. Change the text and then select Ok.

Using the Drawing Toolbar, add your name, class, section and date to the map. Click the Text Style button on the drawing toolbar again, set the point size to 10 and unmark Bold. Click OK. Select the Text button on the Drawing toolbar again, position the cursor on the lower right hand corner lined up with your legend and scalebar. Click and type your name, hit enter then type your class and section (e.g., GEO328-03) and hit enter once more and type the date.

Once your map if formatted to your liking, you can print by selecting File > Print and clicking OK in the Printer Dialog Box. Wait a minute or two; if your map does not print to one of the printers in the rear of the lab, ask a lab assistant for help.

Wrapping Up

Save Your Work. To save your work in MapInfo, click on File > Save Workspace on the menu. In the dialog box that opens, navigate to your Lesson 2 folder on your storage disk. Give the workspace file a simple name, such as lesson2.wor. Be sure to save it with the .wor extension. Exit MapInfo.

Take Work With You. Before you leave, double-check that all your work is on your storage disk. Check on your storage disk for five files. You'll have your MapInfo workspace file (extension ".wor") and the business location file you started with (extension is ".dbf"). You will also have a new MapInfo layer comprised of three layers, with a .TAB, .ID, and .MAP extension. These files represent the new geocoded business locations. If you have followed the directions above, you should have these five files; if not, ask a lab assistant to help.

Eject your flash disk. To eject your flash disk safely (no read/write errors created) first be sure any files on that disk are closed. If you have a MapInfo workspace from that disk open, close it. Click on the icon in the lower right corner of the desktop (near the clock) that says Eject disk. Click on this and then close all flash drives. When the computer says it is safe to remove the disk, only then should you remove it from the computer.

Lesson documentation updated 05/27/08; Ellen Bryson.
The Center for Geographic Information Systems and Spatial Analysis at West Chester University