Transportation Geospatial Analysis - Lesson 3: MapInfo usage tutorial that is more detailed than a flight checklist

This document is my notes from class.

Strictly speaking, because half of the notes are content from the teacher's courseware, I just added my own understanding and explanation to it, so half of the content creation of this note was completed by my teacher.

  • This course is primarily about some practical methods of geospatial analysis.
  • Rather than theory, I care more about how to implement it.
  • I combined it with Python that I usually use to explain and solve problems.
  • Based on Jupyter Notebook

Sharing it here, hope it can help some people.

Review of past transportation geospatial analysis notes:


We've covered the basics. Starting today, we will officially start talking about the operation of geographic information system software. The GIS software we use is MapInfo Professional 12.0

MapInfo Professional 12.0 is a desktop geographic information system development platform that has basic functions such as measurement analysis, buffer analysis, map algebra, polygon operations, and digital elevation model (DEM) analysis. It can complete graphics, interfaces, queries, analysis, etc. Various requirements, providing solutions for resource management, regional planning, land monitoring, auxiliary decision-making, etc., very suitable for military management and command, marketing, urban planning, municipal management, GA transportation, postal and telecommunications, petroleum geology, land resources, Population management, finance and insurance and other application fields. It is a software commonly used by network optimization practitioners. It can import base station layers, longitude and latitude navigation and many other practical functions.

Because it is just the first time to use computer software, the content of this class will not be particularly detailed . It only contains some of the most basic usage methods, but you must be proficient in these most basic usage methods, because they will be used repeatedly later. It is best to achieve muscle memory. As long as you mention an operation, you will immediately know how to do it without having to use your brain.

About MapInfo

Software installation

I won’t go into details here about the installation method of MapInfo software. Because the specific installation method depends on the form of the installation file you get, and generally software resources have independent installation tutorials. But because everyone has generally reported many problems encountered during the installation process, and I have installed this software many times, I also understand some problems that may be encountered during the installation process.

I have sorted out these problems and included them in this article: Summary of problems encountered during the installation process of MapInfo 12.0 and mapbasic 12.0 . If you encounter similar problems during the installation process, you can refer to the solutions in the article.

Basic logic of software operation

As a geographic information system software, MapInfo will include the following things for every engineering project:

First, the MapInfo workspace will contain multiple layers. There will be a basemap layer at the bottom, and all our things are operated on the basemap layer. We see many maps in our daily life, but these maps are actually just a single picture, and the pictures themselves do not contain data.

For example, if we want to know the distance between two points on a map, what we can do is to enlarge the map to standard size according to the map's scale, and then pick up a ruler to measure the two geographical points. The distance between coordinates is converted to a scale to obtain the true distance between two locations. But if our map data contains coordinate information, then we can directly let the software calculate the real distance between two locations through the coordinate data of each point saved in the map.

For the use of the software, what we are actually doing is to import the external base map data, and then process the map to bring the data with it.

Each layer corresponds to some data. These data are stored in the database in the form of two-dimensional tables. We can compare map layers to a spreadsheet, similar to Excel. One row per line objectrepresents a geographical feature (such as a building, road, river, etc.), and one column per column fieldrepresents the attribute of the feature (such as name, area, height, etc.). Through these attributes, we can classify and describe geographic features.

Additionally, map layers contain spatial information. This means that each geographic feature is associated with a specific coordinate location. These coordinates help us pinpoint the location of each feature on the Earth and display it on the map. For the general logic, you can refer to the table below (but this picture is actually something I pulled from the technical documentation of the GeoPandas library, hahaha, it can reflect the problem very well)

Insert image description here

However, we usually only deal with the front part of the data frame, and the subsequent column of geographical information is usually automatically processed by the software for us. (I actually pulled this picture from the technical documentation of the Pandas library)

Insert image description here

Therefore, when we add or edit map layers in GIS software, we are actually operating on this two-dimensional table. We can add new rows or columns to represent new features or attributes, and perform data modification and analysis as needed.

Use of MapInfo

First we must create a new folder . This is very important, because later you will find that the MapInfo project files are in bulk . If they are not packaged in a folder, they will be missing and the project cannot be opened normally.

Prepare base map

Where can we find it on our base map? In fact, according to the teacher's opinion, the best is a formatted .tifbase map, and if there is no such base map, .jpgor .pngthis common network image format can also be used directly.

For example, we first go online to find a map of China and then download it.

The teacher here has helped us find .tifthe format file:

Insert image description here

Because the format of this file is indeed relatively old, it can only be viewed through the Windows Image Viewer.I instantly felt like a child.

Here is a brief introduction to science: Geographic data is divided into raster data and vector data .

  • Raster data : equivalent to bitmap. Raster data is an image made up of a series of squares, or pixels, each of which contains information about some attribute at that location. This type of data is typically used to represent continuous variables such as elevation, temperature, rainfall, etc. For example, we can divide a world map into many small squares and record the average temperature of the area in each square.

  • Vector data : equivalent to vector graphics. Vector data uses geometric features such as points, lines, and polygons to represent geographic phenomena. It stores and represents geographic information by describing the spatial relationship between features. For example, if we wanted to mark a river on a map, we could use line features to represent the path and shape of the river.

First we open the MapInfo software. Now it looks like there is nothing in the central part of the interface. However, there are tabs and toolbars at the top that can be dragged to change the layout.

Insert image description here

  • If you find that the tool box is floating on the left side of the interface instead of being at the top as usual, you can drag it to the top.
  • If you find that the interface layout buttons are too small or missing, you can right-click the toolbar and selectLarge Buttons

Next we open Filethe tab and click Open.

Insert image description here

Click our .tifffile in the interface below and import it into the MapInfo software.

When importing, an import interface will open.

The import interface that appears here is a bit old, so it is not very capable of locating the desired location by default. We have to manually search for the path here.

At the same time, pay attention to selecting the imported file type as raster data Raster Image. Our file is not a vector layer, but a raster layer. It can be seen that the software can recognize multiple types of raster data.

Insert image description here

As you can see, after reselecting the data format, our China map can already be displayed.

In this case, select our China map and then open it to see an option box like the following:

Insert image description here

?

Do you want to simply display the image, orregister it so that it will have geographic
coordinates?

  • Display
  • Register

This question is asking whether you want to just display the image, or calibrate the image to geographical coordinates.

Well, as we just said, what we have to do is to bring data to the map without data. If we choose to only display pictures, then such a map without data is still a map without data. In order to have the data we want on the map, we first need to bring coordinate data to the map, because coordinate data is the benchmark for all other geographical data , so we choose calibration here.Register

Coordinate registration

Next, the software will display a geographical coordinate registration interface like the one below.

Insert image description here

Geocalibration refers to mapping digital maps to real-world geographic locations. In layman's terms, it means to make one-to-one correspondence between the points and lines on the electronic map and the actual geographical location.

In general, the principle of geographical calibration is achieved by matching the coordinate system on the electronic map with the coordinate system of the real world. First, we need to collect some control points with known locations, such as road intersections, building corners, etc. Then, select these known locations in GIS software and mark their coordinates on the electronic map.

Next, we need to use measurement tools to measure the coordinates of these known location points in the real world. This can be done using a Global Positioning System (GPS) or other measuring device. Enter these measured coordinates into GIS software.

Finally, the GIS software will automatically calculate a conversion formula to convert the pixel coordinates on the electronic map into geographical coordinates in the real world. This conversion formula can be applied to the entire electronic map so that all points and lines can correctly reflect the positional relationships in the real world.

By performing geo-calibration, we can ensure that the maps drawn in GIS software are consistent with the actual geographical location, thus improving the accuracy and reliability of the map. This is important for spatial analysis, navigation systems and geographic information management.

According to what the teacher said in class, since this is a map of China, we only need to find the location of a representative city, then check the geographical coordinates of the city online and mark its geographical coordinates.

But actually this doesn't even need to be done. First of all, firstly, this is a map of China. The longitude and latitude lines are already marked on the map. Since there are longitude and latitude lines, georeferencing can be performed by directly taking the intersection of the longitude and latitude lines as a reference point. Taking city marker points is redundant.

On the other hand, the points marking the city are not points in the geometric sense. The city has a certain scale and occupies a certain range in longitude and latitude. The location of the city marked on the map is actually just a relatively accurate location of the city center. . Taking this position results in reduced registration accuracy.

Thirdly, the distribution of cities is irregular. Using longitude and latitude node calibration can select the four corners of a large-scale curved rectangle for calibration, and the effect may be better.

However, since this article is just a class note, we will just follow what the teacher said in class for the time being.

The geographical coordinates of the following cities have been checked here:

City longitude latitude
mohe 122.37 53.48
Taipei 121.50 25.03
Haikou 110.32 20.03
Urumqi 87.62 43.82

We first click on the city point in the selection box below, and then the interface for you to enter the coordinate point will pop up.

Insert image description here

This point here is called a "control point" in the software.

We select and set all four control points, as shown in the figure below:

Insert image description here

Then you can see in the software that the map has been imported at this time.

Sometimes the software will ask you at this location whether you want to set a coordinate system for the project. (This interface appeared when the teacher was demonstrating in class, but it did not appear when I was writing this note, and I did not take a screenshot.)

Since we are still beginners, we will choose latitude and longitudethe (latitude and longitude) option. But in fact we must understand: latitude and longitude are not the only coordinate system. Regarding this issue, we just need to have a concept first, and we will mention it later.

  • longitude n. longitude
  • latitude n. latitude

map file

Don't worry at this time, let's press the save button first ctrl + s. At this time, just open the folder we created separately for the MapInfo project and you will see: the map file already exists here. This map file is .TABin format, and TAB refers to Table. We said before that the essence of the map layer is two-dimensional table information. This is the Table of the base map we just imported.

Insert image description here

So for example, if someone asks you to send a map to them, you can easily package the entire file project and send it to the other party.

Don’t just send .TABfiles, let alone send original pictures without geographical information directly to the other party.

Next time you want to open this project, click on this TAB file. In addition, every time we create a new layer, a new file will be generated separately, and we must store it in this folder to avoid loss and confusion.

Manage and view layers

You can see that the picture is presented as a sub-window at this time, and the sub-window can be enlarged so that we can see it clearly.

Insert image description here

  • This button Insert image description here
    can select vector elements in the map (we have not added any vector elements yet, so they cannot be selected yet)

  • This button Insert image description here
    allows users to drag the map to browse.

  • This button Insert image description here
    opens a layer page (usually shown as a sidebar)

We click the layer button to open the layer menu interface. You can see that there are two layers here: Cosmeic Layer We don't care about it for now. The layer we are showing now is the "China Map" layer below. The mosaic pattern on the left side of the layer represents a set of raster data.

Insert image description here

We click on the mosaic icon to open the interface for editing the basemap style. You can see there are several options here:

  1. Check Style Overrideand click the mosaic icon below to allow free editing of the color difference, grayscale, contrast and brightness options of the base image.
  2. Check it Display within Zoom Rangeto cancel the map magnification size limit. In theory, the map can be enlarged infinitely. However, there is a drawback to this, that is, the accuracy of the map itself is not that high, and the resolution is not that high. But when you need to infinitely zoom the map, you can uncheck this button.

Insert image description here

Create new layer

Now let's create a new City layer to save some information between cities.

Click in the upper left corner Fileand select New Table..., or click the New Table Options button directly on the toolbar. Then the following interface will appear:

Insert image description here

We choose here Add To Current Mapperto add the new coating to the current map.

Next, the following interface will be generated. This interface lets you create layer fields.

The so-called fields are the column names of the two-dimensional table of the layer. Fields can be of type number, text, date, boolean, etc. depending on the nature of the data. For example, if we are now creating a layer containing city population, then this layer may have a "population" field, which is used to store the number of people in each city.

We create the following fields:

Field Name type of data Corresponding content
ID integer Point data number
name character city ​​name
popu float population
GDP float GDP

After creation, an interface like the following will appear. I deliberately namewrote the wrong field as a floating point number type here, and I will show you how to modify the wrong field.

Insert image description here

If you accidentally write the wrong field type, you can modify it as follows:

Table StructureFirst, find this option in the tab bar .

Insert image description here

After clicking, the same interface as the previous field type setting will appear, and then you can adjust it again.

Create layer data points

We now click the punctuation tool in the toolbar to mark some cities on the map. We selected 11 cities: Hefei, Nanjing, Wuhu, Shanghai, Suzhou, Shaoxing, Hangzhou, Huangshan, Zhoushan, Taizhou and Wenzhou .

Tip: Sometimes you will see that the prick tool is gray and cannot be clicked. This may be because you set the layer to non-editable mode. At this time, look at the layer manager on the left. There is an icon of a pencil with a sticky note on it next to the layer. If this icon is gray, it means that the layer has been set to a mode that cannot be edited. Click this icon to resume layer editing. Then you will see that the punctuation tool in the toolbar above becomes colored and can be used.

When we just finished marking, we can see that this point is displayed as a small black five-pointed star on the map size = 12, which is very unclear. We're going to zoom in on this display here.

First of all, you can see that this layer has been added to the layer bar on the left City, and there is a small star icon to the left of the layer column item. Click this icon to set the legend option

Insert image description here

As shown in the picture below, we click on the little star icon:

Insert image description here

Then you can enter the interface for setting the legend. Here we set the legend to dots, the color to red, and the size to 18

Insert image description here

At this time, you can see that our points have become clear. Even if you zoom out on the map, you can clearly see where these points are.

Insert image description here

We right-click the layer in the layer manager on the left and click Browse tableOptions to open the layer's attribute table.

At this time, you can see that all the values ​​​​in the attribute table are 0, and the text object is empty. This is because we haven't added the sample point information yet. At present, these model points are just empty geographical coordinates without corresponding information.

Update column

There is an ID in the attribute field we created before, which is the number of each sample point. We now need to give each sample point data a number value. So what we have to do is number these sample points from 1 to n in the order we add them to the map.

Of course we don’t need to do repetitive work like this ourselves, the software has already provided the function.

We select Open in the tab bar Tableand select Update ColumnOptions.

Insert image description here

The following interface will appear. You can see that the fields here IDhave just matched.

Insert image description here

We can then use MapInfo's built-in rowidfunctions.

(If I'm not mistaken, this rowidfunction should originally be a built-in function of the Oracle database. Because the essence of a geographical information system is a database, it should be called directly here. I don't know, I guess)

Just enter it directly like below.

Insert image description here

Logically speaking, if there are no problems, you should be able to see that the ID of each data point has been automatically matched, and the order of the ID is the order in which you created the points.

Edit property sheet

Add data points

In the map on the right, use the selection tool to select each sample point one by one to edit its properties, and write the contents in the following table to the layer:

ID City popu GDP
1 hefei 963.4 12013.1
2 Nanjing 949.11 12013.1
3 Wuhu 373.1 4502.13
4 Shanghai 2475.89 44652.8
5 suzhou 1291.1 11521.41
6 Shaoxing 535.3 7351
7 Hangzhou 1039 18753
8 huangshan 132.3 1002.3
9 Zhoushan 117 1951.3
10 Taizhou 667.8 6040.72
11 Wenzhou 12110 8029.8

After the layer information is edited, it looks like this:

Insert image description here

The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly.

Then for example, if we now want to add a new coordinate point "Yancheng", we can click on the location of Yancheng on the map.

Here you can see that "Yancheng" has already appeared here. We manually write in the population and regional GDP of Yancheng.

But at the same time, we can also see that the ID value of the coordinates is wrong. The newly added "Yancheng" ID becomes 0 and appears at the bottom of the IDs of all coordinate points.

Insert image description here

The way to solve this problem is also very simple, which is to re-perform the operation of updating the column before.

We open the tab of the updated column and re-enter it rowid. Because the operation process is exactly the same as before, I will not demonstrate it here. In short, after re-executing this step, you can see that the ID changes to the following picture:

Insert image description here

Delete data points

I won’t take screenshots here because it’s too simple, so I’ll describe it in words:

Directly select the sample points in the picture, then click on the sub-window where the attribute table is located, and press the key on the computer keyboard delete, and these sample points will disappear.

Of course, you can also use the batch selection tool in the toolbar to select batch sample points. You can also switch to the sub-window where the attribute table is located, and then press the button on the keyboard delete.

There is a series of selection buttons in the toolbar Insert image description here
, providing different ways of selecting sample points. I won’t introduce it in detail here, you can try it yourself

My main focus here is how to delete specific sample points through search and filtering.

Find data points

What we're looking for here is data points. In order to better express the effect, I will add some more data points of cities here. The method of adding a new city is exactly the same as before, so I won’t demonstrate it again.

The search function is in the following place: select Qurey, then selectSelect

Insert image description here

As an example, we filter here for cities with a population of less than 10 million people. The method is very simple: just enter the expression: popu < 1000and that's it.

(If you are filtering a character object, for example, if we are looking for the city of Shanghai, you should enter it name = "上海". The key here is to add double quotes to indicate that this is a string.)

Insert image description here

As you can see here, these data points have been selected whether in our attribute table or on our map.

Insert image description here

What we found are the following cities.

ID City popu GDP
1 hefei 963.4 12013.1
2 Nanjing 949.11 12013.1
3 Wuhu 373.1 4502.13
6 Shaoxing 535.3 7351
8 huangshan 132.3 1002.3
9 Zhoushan 117 1951.3
10 Taizhou 667.8 6040.72
12 Yancheng 668.97 7079.8
13 Suzhou 530 2224.6
14 Bengbu 330.9 2012.3
15 Jiujiang 457 4027
16 Jingdezhen 162.185 1192.19
17 yingtan 115.58 1237.55
18 Nanchang 653.81 7203.5

As long as we press the button on the computer keyboard delete, these points will disappear. As a result, all that's left on our map are these big cities:

Insert image description here

But there is another problem here. I think everyone has discovered that there are many gray lines in this table. What this line represents is that although you seem to have deleted the point, in fact the point is still in the database. These gray lines represent that there is redundant data here. If this redundant data is not cleaned up, it will continue to occupy disk space.

We next need to clean up these redundant data, and the method we use is to compress the attribute table.

Compressed attribute table

First, we find the option to compress the attribute table in the tab bar.

  • MaintenanceThe meaning here is to maintain the attribute table

Insert image description here

Then in the menu below, we choose to compress general attributes and geographical attributes.

Insert image description here

After clicking, you can see that these gray lines have disappeared, which means that we have cleaned up the redundant data.

At this time, the software will also ask you whether you want to save a copy of the data when compressing the data. This depends on your specific requirements.

Insert image description here

The last map we saw looked like this.

Insert image description here

Of course, because we deleted these data points, the order of the IDs is messed up again. We still need to perform rowidthe operation again to ensure that the ID sequence of each data point is correct.

vector layer file

Generally, a vector layer will have one TABfile, which contains text information; one DATafter IDanother MAP, they are all Binary files, which cannot be opened by ordinary editing tools.

If it is necessary to forward the file, you must remember to send the four pictures to others at the same time to ensure the integrity of the vector map layer.

Guess you like

Origin blog.csdn.net/BOXonline1396529/article/details/132911482