Extracting data from a database

This is done in 2 main steps.

First of all we create a a polygon extract and save this as a .dra file.

Then we employ a Utility to Extract the data from the database that it was originally associated with.

Select and save .dra

To extract polygon data you can use the query tool, except that this will require there to be an underlying database.

Make sure that you have selected the Default tab as an On-Hit option, in the data Link tab in the Project Manager.

Options for selection (CTRL Q to select – other options go to tools select Query options):

  • to create a box selection, click and drag
  • to create a circle, hold down the C key and click and drag
  • to create a linear selection, hold down the CTRL key and click and drag

Now copy to the active layer, delete anything you don’t need and then save with a memorable new file name.

Alternatively copy everything to the Live Layer and use the Selection Tool to select your polygons, as above, or use the Selection Manager to create more complex queries. “Save selection” rather than whole Live layer and continue with the second half of the process.

Make a database extract

From the Utilities menu, select under the first item Make database extract for .dra and follow the steps carefully:

  1. Select the .dra file you’ve just created
  2. Link to the old database
  3. Chose the link column (a unique id)
  4. Save to a database extract with the same name as your .dra

If all is well, you can now edit your .dbf file and edit or export to some other format.

Importing a database

Database before
Database before: using the basic labels

Although this is not difficult, it can be headache to prepare your data.

There are a few steps:

  1. Create a database file with attribute data in Excel
  2. The first column should be named ‘ID’ corresponding to the ID in Map Maker.
  3. The database id must match ONLY one label in the .dra file (remember you can edit the .dbf file from the Project Manager Data link menu or Utilities, Edit Database).
  4. The spreadsheet can ONLY have as many rows (ex the title row) as there are mapping units (lines, polygons which are best not mixed!).
  5. Also, the ID column must be text format and any formulas converted to values.
  6. There should be no empty values (remember to use the default -99 for missing values)
  7. Save this file as an .dbf (or .xls file, though this can be problematical)
  8. When this is done, you can import into MapMaker.
  9. This is done through the Project Manager, and the layer that you wish to link to (chose .xls from the drop down).
Database after
Database after: a new database has been attached and different columns show

This process is by no means simple, especially if your database and polygon files are complex and reference to the Map Maker manual is highly advisable.

Simple database query

Create Database Column
Create Database Column

Now that we have a database, certain query options become available.  Before you can query the database, with the data tool, you need to check that the database is hit-able.  To check this option, go the layer submenu and you can click make hit-able, or do the same in the database subtab in the Project Manager.

Now when you click a polygon you’ll get a simple pop up of the underlying information as it relates to the selected feature.

Also in the project manager, note the Link Column.  In most cases it will be the first column or ID.

The On Hit tab has an option to make the database Read Only, including a variety of other useful options that will be explained later.

It is possible now to edit the database in Excel, remembering only that each row MUST correspond to an id in our polygon file.  However we can add further columns, remembering here that all we need to do is to add a descriptive title.

There is an option, within Map Maker itself, to add rows and columns, provide a column heading or title, set the default format, move columns to the left or the right and rows up and down.  Advanced options are available here too.

Query Database
Query Database

You can add data on a per record basis, but remember that the built in tools can give a number errors.  Adding columns can shunt data around unpredictably, so always it carefully or preferably stick to Excel.

Now when we use the query tool, you can see the new column Description is viewable.

Editing basic attribute data

Data Query
Data Query

Although we’ve covered this before, it is worth dwelling on how this works in a bit more detail.

If you are editing data or creating new data, you can create basic labels as you go OR you can add or refine them later. If you want to modiy a saved layer, remember that you will have to copy it to the Live Layer.

Using the simple Edit functions (the CTRL+E key combination) and clicking on the polygon or feature, selecting the Basics tab allows you to modify the polygon’s Label or modify it’s ID.

Until such time as we create an associated database, there will not be scope to add additional information in the form of attributes tour simple data.

To create a database, we use the Utilities menu to generate columns from .dra file.  The diagram shows that we can select at any number of columns to associate from the .dra file – except the ID is the only obligatory one.  At this point, there is no link to the database, we have simply created a database based on the .dra file, which can be different from the one displayed on screen.  The database is saved as a .dbf file and can be read by a number of spreadsheet programs.

Create Database
Create Database

So the next job is to link the database to the .dra file and save this all as a project.

The linking is performed through the project manager.  The link tab is next to the style tab.  Simply choose the database you’ve just created.

Now, when we go to edit a polygon (in Live Layer), you’ll see that a new Data tab appears alongside the Basics, Style and Actions, which has automatically created a number of fields, provided you selected them.

When you save your .dra file, you should also be prompted to save the database file.  It is usually safe to overwrite the existing one, unless you have performed a large number of changes.  If you experience any issues you should save everything (.dra and .dbf) with a new name.

Creating a database

Basic Polygon Attributes
Basic Polygon Attributes

Up to now we’ve confined ourselves to working with third party data or creating and printing simple polygon or line drawings.

Map making comes into its own when using databases.  When using a third party data set we found that we could style a map according to different columns in the database.

In the next set of lessons we are going to learn about how to work with databases and create and edit a new database.

Databases are regarded as Advanced.

The database simply holds pieces of data in rows and columns, like an excel spreadsheet. These data are not normally graphical nor spatial but describe your data set. They are often known as attributes and can be linked to a feature on the map (a polygon, line or point) for display purposes or for interrogation using a query tool – or even excel. Attribute data needs to be collected systematically and correctly to be useful.

If you are working with a third party data set and NOT using the native .dra Map Maker format, ALL the information used for styling a map will be contained in a database, which you will need to link to.

HOWEVER basic attribute data – styles (numbers) and labels (text) – are handled differently in Map Maker.

If you are using Map Maker to create linework, then the style numbers and the labels are stored in the .dra file, which is created when you save a layer. The fact that you can create another database with new information for styling purposes or with specific display labels can be a bit confusing. You can even extract the information from the .dra file and then use that to build your database.

When you first digitised a line or a polygon, you had the option to enter / edit the display label. These can be left as temporary identifiers and edited later. Alternatively we can attach a database and use the data from the database for styles & labels.