MapInfo Pro

 View Only

MapInfo Monday: Creating new Tables

  • 1.  MapInfo Monday: Creating new Tables

    Employee
    Posted 03-27-2023 06:10

    Happy #MapInfoMonday!

    When you start using MapInfo Pro, you quickly realize you need somewhere to store the data you are capturing. I often see users using the Cosmetic layer to store custom data about the business. The better way is to create tables to hold your data. And make one table for each data type instead of mixing them into a single table.

    By separating your data into multiple tables, you can control what data you want to view on your map. You can also more easily run queries on your data, and control how to style the data in a map using a global style for the layer or through a thematic map. The table structure, with this I mean the columns in your table, will also be more "lean" if you don't mix different data types. And having your data separated into multiple tables gives you also better control of the draw order in the map.

    Creating New Tables

    Let me run you through the process of creating a new table, and give you a few tips on the way.

    From the Table tab, you can access the New Table control which helps you make a new table.

    First, you will be asked how to show the new table once it has been created. You can show it in a browser window, open it into a new map window, or add it to an existing map window if you already have one open.

    Next, you can control how to create the table structure. You can create a new structure from scratch, or inherit the structure from an existing table. The latter is only possible if you have another table open. In the image below, I have no tables open so the Using Table option is disabled as I can't inherit the structure from another table.

    If you have other tables open, you can pick one from the list Using Table, see below.

    If you chose to inherit the table structure from an existing table, the New Table Structure dialog will hold a list of columns from that table. I chose to create a new structure so the New Table Structure dialog comes up all empty.
    A table needs at least one attribute column. Column names may not hold spaces or special characters besides the underscore (_), and they can't begin with a number. An Extended Table in MapInfo Pro can now have up to 999 columns. That's probably enough for most use cases.
    Click on Add Field to add a new field. Now give it a name and select the Type for the column. Some column types also require you to specify a width. That's the case with the Character and Decimal column types.
    MapInfo Pro supports these Column Types:
    • Character: Stores up to 250 alphanumeric characters. You cannot perform arithmetic operations on numerals in a character field. You should store ZIP Code information in character fields, otherwise, leading zeros are dropped. 
    • Integer: Whole numbers (without a decimal) from -2,147,483,648 to +2,147,483,647 (inclusive); stored in 4 bytes. 
    • Small Integer: Whole numbers from -32768 to 32767 (inclusive); stored in 2 bytes. 
    • Large Integer: Whole numbers from –9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 (inclusive); stored in 8 bytes. 
    • Float: Stores numbers in floating-point decimal form. 
    • Decimal: Stores numbers in fixed-point decimal form.
    • Date: These fields can contain a calendar date in the format DD/MM/YYYY. The year can be specified by two or four digits and is optional. Use slashes or hyphens to separate components of a date. The input and display of dates are controlled by your Regional Settings.
    • Time: These fields contain time-based information in the format HHmmssfff, where HH refers to hours, mm refers to minutes, ss refers to seconds and ff refers to fractions of seconds. 
    • Date/Time: These fields contain date and time-based information in the format yyyyMMddHHmmssfff where yyyy refers to years, MM refers to month, dd refers to date, HH refers to hours, mm refers to minutes, ss refers to seconds and ff refers to fractions of seconds. 
    • Logical: These fields contain only true/false or yes/no information, stored as T for true/yes and F for false/no. Decimal, integer, small integer, and float can only contain numeric symbols.
    Now click on Add Field again, give it a name, and select a type. Do this until you have added all the necessary fields, or columns, to your table.
    Now it's time to ensure the right Projection has been applied. If you hold the cursor over the Projection... button, a tooltip will appear and tell you what projection currently is specified. Click the button and change the projection via the Choose Projection dialog.
    Via the Preferences in MapInfo Pro, you can configure a default projection for new tables. This may avoid additional clicks if you often create tables using the same coordinate system. Check 11: Default Coordinate Systems in MapInfo Monday: 13 Preferences to check and configure in MapInfo Pro.
    Back in the New Table Structure dialog, click on Create....
    Now it's time to specify where on your computer or network, you want this new table to be created. Use this dialog to browse to the desired location.
    A few other things to check here are:
    1. Projection: We did cover that earlier, but here you can also change the projection of the new table if you forgot in the New Table Structure dialog.
    2. File Type: Using the Save as type list, you can select between a couple of MapInfo Tables types. You'd often save your tables as either Native Tables or Extended Native Tables. The main differences are that the extended version allows you to save huge amounts of data (more than 2GB) into the table, and it also supports more columns. The benefit of the Native Table is that it can be opened in older 32-bit versions of MapInfo Pro.
    3. CharSet: The character set of the table can also be important. This determines what character can be saved into your table. If you only work with data from Western Europe or the US, you can choose Windows US & W. Europe ("ANSI"). If you work with data from a mixture or countries, or data from India, China, or Japan - just to name a few. I'd suggest you choose UTF-8 or even UTF-16 which allows you to hold the specific characters from the languages of these countries. UTF-8 is also commonly used across systems so that could also be a valid reason to use that over ANSI.

    There is also a preference that controls your preferred table type and charset. Read more about this in 2: New Table n MapInfo Monday: 13 Preferences to check and configure in MapInfo Pro.

    Now click Save to create the new table and open it into your preferred view. And now you can start adding data to your table.

    You can always create a new table when you get the need. That new table is only a few clicks away.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------