Thanks for these follow-up questions.
1) I have added that to the original post. We still need to add this support to EFAL, GDAL, and the MIF/MID format
3) I have attached a table with powerlines where the nodes have been assigned a Z value
Original Message:
Sent: 09-14-2023 03:27
From: Uffe Kousgaard
Subject: MapInfo Monday: Working with M & Z Values on Objects in MapInfo Pro v2023
A couple of questions:
1) Does MIF now support M/Z values?
2) If the old TAB format has supported it for many years, how do you create such a table from scratch, pre-2023? I remember to have seen it mentioned in the MFAL library, but never looked into it. It has a type called CSYS_MZ_INFO. EFAL seems to have functions for it too.
3) Do you have a sample table to download?
------------------------------
Uffe Kousgaard
ROUTEWARE
Roskilde
Original Message:
Sent: 09-13-2023 04:29
From: Peter Møller
Subject: MapInfo Monday: Working with M & Z Values on Objects in MapInfo Pro v2023
Happy #MapInfoMonday! And yes, the calendar shows Wednesday but during the release week for MapInfo Pro v2023, we decided to do #MapInfoMonday articles all week long!
Our Native TAB format has supported M and Z values for a long while, but we haven't done much to make this accessible to you. You have been able to use MapBasic to inspect M & Z values on objects brought into MapInfo Pro through formats like GeoJSON, ESRI Shape, and others.
With MapInfo Pro v2023, we have extended this in several ways.
What benefits does Support for M & Z Values bring?
The support for M & Z values allows you to assign two attributes at the node level. Until now, attributes have been assigned at the record level which meant that the entire object would hold a given value. With M & Z support, you can assign one or two values to the individual node of a polyline or polygon. This means the value can vary along your object.
A couple of examples where M & Z values can be useful. Imagine you are a fiber optic company laying down fibers. When you measure these, you also capture the elevation along the fiber. Until now, you would have to store that elevation in a separate table of points where the Z value would be stored in a column. With support for M & Z values, you can store the elevation on the node of the polyline.
The next step is to visualize your data in 3D. here you will be able to take advantage of the elevation stored on the nodes and position the fiber at the measured elevation. This should position your fiber lines underground.
It can of course also be lines hanging in the air like the example you can see in the 3D Map below.
Support for M & Z Values
Before you can take advantage of storing M & Z values in a MapInfo TAB file, the table needs to be configured to support M & Z. You do this in the New Table Structure dialog when you create the table. You will find the Support M/Z option just above the Projections... button.
If you have an existing table that you want to alter so that I will support M and Z, you can save a copy of the table, and in the Save Copy of Table As dialog, check the Support M/Z option.
In the Table List window, you can quickly see if a table supports M/Z or not. The tables that do, use an icon with more color to it adding some perspective to the small drawing. The tables that don't support M/Z, are grey and flat in their appearance. In the image below, the tables Streams
and Lakes
don't support M/Z values.
If you double-click on an object to bring up the Object Info dialog, this dialog will show if that specific object has been assigned M and/or Z values. Below you can see an example of the Polyline Object dialog where the selected polyline has Z values assigned to it. If you double-click on a point object with Z values, the Point Object dialog will also show the actual Z value.
Keep in mind that even though a table supports M and Z values, all objects in that specific table might not have been assigned any of these values. The Has Z option in the dialog above means that the currently selected polyline has Z values assigned to one or more nodes. The polyline next to the selected may support M and Z values but might not have been assigned any yet. In that case, the Has Z option would be unchecked.
In this section of the article, I will highlight the existing and new MapBasic functions and statements that can help you work with M and Z values on objects. We have for a long time been able to get to these values through MapBasic. The new thing is that we now also allow you to set or change these values.
At a table level, you will be able to get and set if the table supports M and Z values. The Set option refers to creating a new table and saving a copy of a table.
When saving a copy of a table, the support for M/Z is controlled by the SupportMZ
option. If you leave out this option, the new table will inherit this setting from the original table. Alternatively, you can use the SupportMZ
option followed by either On
or Off
to control if you want the table to support (On
) or not to support (Off
) M/Z values. Below you can see an example where I explicitly set the table to support M/Z values.
Commit Table Rain_Water_Pipe As "C:\Sewer\Rain Water Pipe ZM.TAB" TYPE NATIVEX Charset "UTF-8" SupportMZ On
Note that Support for M/Z values is built into both the two Native TAB formats, the classic Native format as well as the Extended NativeX format.
When you create a new table, you specify the support for M/Z when you make the table mappable through the Create Map
statement. You control this through the SupportMZ
option similar to what you saw with Commit Table
. Below is an example where I have created a new table and now want to make it mappable using the coordinate system of another open table. I also use the SupportMZ option to force the table to support M/Z. If I leave out the SupportMZ
option, it will inherit the settings from the table I refer to.
Create Map For Rain_Water_Pipe_ZM CoordSys Table Rain_Water_Pipe SupportMZ On
You can read the M and Z details from an object using these functions.
The function ObjectInfo()
can tell you if a given spatial object supports M or Z values using the attributes OBJ_INFO_HAS_M
and OBJ_INFO_HAS_Z
. You need to check this before reading these values.
To get to the actual values for point objects, use the function ObjectGeography()
and the attributes OBJ_GEO_POINTM
and OBJ_GEO_POINTZ
.
To get to the values on nodes on polylines and polygons, first use the functions ObjectNodeHasM()
and ObjectNodeHasZ()
to determine if the specific node has been assigned an M/Z value. If a value has been assigned, you can get to that value through the functions ObjectNodeM()
and ObjectNodeZ()
. Each of these functions takes an object, the segment/polygon number, and the node number as input.
The add-in DrawTools - which can be found and installed from the MapInfo Marketplace - comes with several features that allow you to start working with M and Z values on your object.
It allows you to assign M and/or Z values to existing objects in a table, you can offset existing objects in XYZ, and you can update nodes on polylines and polygons using a node table. The node table can also be created using DrawTools allowing you to assign for example Z values to the nodes from a digital elevation model and then bring those values back onto the nodes.
Known Limitations
Only polygons, polylines, points, and multipoint objects support M & Z values.
Many object processing tools do not support M & Z values and will be disabled if the editable layer supports M & Z values. That's tools like Erase, Erase Outside, and others that modify your spatial object typically using another spatial object. This has been put in place to not lose the M 6 Z values assigned to the objects being processed. Object Processing can still be done via MapBasic statements but it will be up to the developer to handle potential M & Z values.
Give it a try
If you want to give the new version of MapInfo Pro a try, grab a 30-day trial version and take it out for a spin. We would love your feedback!
As I mentioned above this is one of several #MapInfoMonday articles about the new features of MapInfo Pro v2023. Stay tuned for more!
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------