MapInfo Pro

Expand all | Collapse all

MapInfo Monday: Reordering projections in the Projection File

  • 1.  MapInfo Monday: Reordering projections in the Projection File

    Posted 06-21-2021 05:23
    Edited by Peter Horsbøll Møller 06-22-2021 08:46

    Happy #MapInfoMonday​,

    Today we go a bit behind the scenes of MapInfo Pro. We will look at how you can reorder the way projections appear in the projection dialog, we will add a custom group of projections, and we will discuss why this can be a good idea.

    First, a warning: we are modifying a file used by MapInfo Pro if you make changes that makes MapInfo Pro unable to read the file, you may be in trouble. Therefore, always create a copy of the file before making any changes to it.

    Also note that in MapInfo Pro, we typically use the words "Projection" and "Coordinate System" interchangeable. We normally use the term "Projection" in the software for "Coordinate System".

    The Projection File

    MapInfo Pro comes with a preconfigured projection file with thousands of defined coordinate systems. This file can differ slightly between the different language versions of MapInfo Pro. Besides having translated names for the categories and the projection names, some localized versions of MapInfo Pro also have a slightly different order of the projections. Typically, we can have moved the local projections to the top of the projection file.

    You can find the Projection File, MapInfoW.PRJ, in the folder where you have installed MapInfo Pro. It's a basic text file so you can open it with your preferred text editor.

    If you are using a localized version of MapInfo Pro, you have to locate the Projection File in a subfolder. For Danish, look in the folder "da", for Finnish look in "fi" and so on. If the subfolder doesn't contain a MapInfow.PRJ, use the Projection File in the main installation folder.

    Also, note that the Projection File can be shared in your organization via the Workgroup Directory.

    The typical English Projection File comes with the Longitude / Latitude coordinate systems at the top. Longitude/Latitude (WGS84) is also the predefined projection to use in MapInfo Pro unless you change this via Map Preferences.

    Above you can see the Projection File opened in a text editor, and below you can see how the file is represented in the Choose Projection dialog where you typically would select the projection to use.

    Reordering the Projection File

    For reasons we will discuss later, it sometimes can make sense to change the order of the categories and their category members.

    In this example, we want to move, or copy, the Danish Coordinate systems to the top of the Projection File.

    First, you need to locate their current position. Typically, the coordinate systems are ordered alphabetically. You can also try to search for the country or language name to locate the coordinate systems. The Danish coordinate systems are located after "Croatia".

    The next step is to select the Category and its Category Members and either copying or clipping these. As MapInfo Pro doesn't mind having a projection multiple times, you can use Copy to be on the safe side in the Projection File.

    Also notice that there are two sets of coordinate systems for Denmark: Bounded and Unbounded. We decide to copy both.

    Now go to the top of the file, and paste the copied text into the file. Make sure you have an extra line between the different categories. This makes it easier to read the file for you.

    Save the file and check out the list of Categories in the Choose Projection dialog in MapInfo Pro. You can for example access the dialog from the Map Preferences via the Projection tab.

    Note that MapInfo Pro reads the file every time you go to the dialog. This means you don't have to restart MapInfo Pro every time you make changes to the Projection File.

    Adding Custom Group to the Projection File

    Now that was quite easy, right? Let's take this a step further as you often use coordinate systems across multiple categories. Therefore it would make sense to create a custom category and add the coordinate systems that you often use to this category in the Projection File.

    The first step is to copy the category line from one of the existing categories and change the name to your preferred category name, like "My Favorite Coordinate Systems". Make sure that you add this to the top of the Projection File for easy access.

    The next step is to look through the Projection File for the coordinate system you often use. For each of these, make a copy of the line and paste it under your new custom category. In the end, the list could look like this which is mine:

    In the Choose Projection dialog, the list of Candidate Members will look like this:

    A nice list of my favorite coordinate systems with easy access as I don't need to switch to different categories to locate the specific coordinate system. As you can see this list contains a mix of coordinate systems from Denmark, the United Kingdom, Lat/Long, and Projections of the World.

    Why the order matters

    As promised earlier, I also want to share why the order matters.

    It comes down to the way MapInfo Pro remembers a coordinate system and looks for a match in the Projection File.

    When you select a coordinate system from the Choose Projection dialog or sets a current coordinate system for example using a MapBasic statement, MapInfo Pro only remembers the parameters of the coordinate system. It doesn't remember the name of the coordinate system, nor does MapInfo Pro cache the EPSG code for the select coordinate system.

    The parameters of the coordinate system are the numeric values you can see in each line after the name of the coordinate system. The name of the coordinate system also contains a potential EPSG code for the coordinate system. This is given using the \p parameter at the end of the name of the coordinate system.

    As it only stores the parameters internally, MapInfo Pro has to search through the Projection File to again find more details about the coordinate system, such as the name and the EPSG code. This search starts from the top of the file.

    Having your most commonly used coordinate systems at the top will make this search faster. Not that I think you really would notice the difference though.

    There is another more important reason the order matters.

    There are examples of coordinate systems using the same parameters but different names and, more importantly, different EPSG codes. One example of this is a commonly used coordinate system in Denmark:

    "UTM Zone 32 Euref89\p25832", 8, 115, 7, 9.0, 0, 0.9996, 500000, 0

    This coordinate system also comes in a more generic version under the category "ETRS Transverse Mercator (ETRS89)"

    "ETRS TM Zone 32, Northern Hemisphere (ETRS89)\p3044", 8, 115, 7, 9, 0, 0.9996, 500000, 0

    As you can see the parameters are alike, but the name and the EPSG codes are different. If you are using one of these, MapInfo Pro will use the first one it finds in the Projection File. And this will also decide which name and which EPSG code MapInfo Pro will select.

    For the name, it can be annoying to see a name that you don't expect but things will still work.

    For the EPSG code, it can get more complicated. Especially when you use MapInfo Pro in combination with other systems or databases where the coordinate system is determined by the EPSG code. One such example is SQL Server Spatial, and the problem here is worsened by the fact that SQL Server Spatial doesn't support coordinate transformations out of the box. Therefore it's important that the data is stored using the same coordinate system determined by the EPSG code.

    If you are using MapInfo EasyLoader to upload data to SQL Server, make sure to copy your Projection File from the MapInfo Pro folder to the folder where EasyLoader is installed. Otherwise, EasyLoader can assign a different EPSG code to the tables in the database than the EPSG code you are using in MapInfo Pro.

    I hope you found this useful.

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

  • 2.  RE: MapInfo Monday: Reordering projections in the Projection File

    Posted 06-23-2021 00:54
    Thanks for that information, Peter. More EPSG codes in the MapInfoW.PRJ file, please!

    This is a good opportunity to advertise my free "Projection Explorer" App. You can download this app from the Windows Store - just open the Windows Store on your PC and search for "Projection Explorer" by Roberts Geospatial Engineering. It is free and there are no strings attached, so give it a try!

    The App is a demo and serves no actual purpose, but Pro users might find it interesting. It also works from the MapInfo PRJ file so you will see the list of coordinate system categories and members, just like you do in Pro. In addition to this, the App provides a number of additional features -

    1. It has a "Recent Selections" category at the top of the list and whenever you dismiss the dialog via the "OK" button, your coordinate system selection is saved to Recents.

    2. It has a text search function so you can search for coordinate systems by typing in matching text. For example, you can type in an EPSG code and it will find the appropriate member.

    3. It has a World Map that you can pan and zoom. Double click on the map and appropriate coordinate systems for the location will be presented.

    4. It has a Preview Map which applies the coordinate system to the World Map on the fly and shows you what it will look like.

    5. It has an Information dialog so you can get some detailed information about a coordinate system.

    6. It has a mechanism to add user-defined coordinate systems.

    You can read about Projection Explorer on my website here. I appreciate any feedback, either through this forum or by emailing me directly or via the Roberts Geospatial Engineering website.

    Sam Roberts
    Founder, Roberts Geospatial Engineering