Moving forward, some of the #MapInfoMonday posts will allow you to practice your MapInfo Pro skills. Using MapInfo Pro and sample data from the Precisely Data Experience, I will give you a few exercises and solutions. As always with MapInfo Pro, you can solve a problem in many ways.
I would also like to challenge you to provide alternative solutions to the exercises so that we all get wiser. Thanks!
This is the first of such an article.
Prerequisites
From the Precisely Data Experience, create an account and log in.
Now click on the Sample Datasets button in the Explore section.
Click on the Street tab and download one of the StreetPro (Display) datasets. I will be using the sample for Germany.
Once downloaded, unzip the file so that you can access the data from MapInfo Pro.
In MapInfo Pro open one of the workspaces. I'll be using the workspace deu_streetpro.wor.
In MapInfo Pro open the SQL Window from the SQL dropdown on the Table, Map, or Spatial tabs.
From the table DEU_Business_Locations
select electric vehicle stations using the column Category
. Query the records into a query named qEV_Stations
.
Add the query to your map and style the layer with an appropriate symbol.
In the SQL Window, select the table DEU_Business_Locations
from the Table list. Make sure it's inserted after the From
keyword.
Insert the Where
keyword a new line before the Into
keyword.
From the Column list, select the Category
column. Make sure it is inserted after the Where
keyword with a space in between.
Now type in the =
operator or select it from the Operator list.
Finally, you can select the value you are looking for from the Value list. Try to filter the list by entering a few letters from the word.
The final query looks like this:
Delete the *
after the Select
keyword and keep the cursor positioned here. The *
tells the Select
statement to bring back all columns from the table(s).
Now from the Column list, click on the Name
column and then on the Category
column to insert these at the cursor position. You can also double-click on the last column you want to select from the list. This will close the list.
Select DEU_Business_Locations.Name, DEU_Business_Locations.Category
From DEU_Business_Locations
Where DEU_Business_Locations.Category = "Electric Vehicle Station"
Into qEV_Stations
When you execute the query, the previous query will be closed and the new will be added to the map window. You will have to change the Style Override again.
Use the Info tool to query one of the points in the query. Notice that the Info window only shows the two columns included in the Select
statement. Note that the spatial object also is included as the query can be added to the map window.
In the SQL Window, click on the Create New Script button to create a new Select script.
Position your cursor after the From keyword and select the table DEU_Street_1
from the Table list.
Delete the *
after the Select
keyword. Enter the text HighwayBuffer
in quotes. This will be an attribute assigned to the resulting buffer object. Add As "Type"
to rename the resulting column to Type
.
Now from the Aggregate list, select AggregateBuffer
which will combine all the records and add a buffer around the combined object. Let's specify a resolution of 36
which is the first parameter after obj
, and set a buffer width of 500 meters. 500
should be the third parameter and "m"
the fourth and last parameter.
Change the output query name from Selection
to qHighwayBuffer
.
The final query looks like this:
Select "HighwayBuffer" As "Type", AggregateBuffer(obj, 36, 500, "m")
From DEU_Street_1
Into qHighwayBuffer
Before running the query, again make sure the resulting query table gets added to your map and not to a browser.
Drag the query to the top of the map, and click on the style thumbnail to pen the Region Style dialog. Change the styling.
Finally, with the layer selected go to the Style tab and set the Layer Translucency to 50%.
You should now see a map like this.
I'm looking forward to your great alternative solutions.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------