Continue from the previous blog post Overlay Locations on a 3D Map, we will further explore Maps Online app. In this post I will show you how to fetch map data from a new WMS server and then plot it on a plane with 3D bars on top of it.
If you are willing to walk through the steps with me, please download this Sample_Data.zip file and extract to open the project file Sample Data.opj. You should see a workbook with the longitudes, latitudes and population of a few countries, which will be overlaid as 3D bars on the map as shown above. Just let you know, the final graph could be found in Results_Folder through Project Explorer.
Fetching Map Data from a New WMS Server
The Maps Online app offers a few built-in map data sources for users to choose from, you can also add your own map source to it.
Adding New Map Source
1. Click on the Maps Online app icon on Apps Gallery window to launch the app.
2. Click the button on the right side of Map Source option under Source group, it will open MapsOnline.ini text file. Now copy and paste the following text string to the position right below the last map source entry:
3. Then the updated MapsOnline.ini text should be as shown below:
4. Now go to the File menu of Notepad and choose Save option to save the .ini file. Then close the file.
5. When you click Map Source drop-down option in Maps Online dialog again, you should be able to select the newly added entry SEDAC. Click to select it now.
Combining Two Maps into One Map
Most often we will find the maps are either purely color filled with no boundaries or only boundaries with no color filling. With Maps Online app, we can combine a color filled map with a map has only boundaries into one map. To do so, follow the steps below:
2. The first map with Title cartographic:national-boundaries is a black-and-white boundaries world map, and we want to combine it with a color filled map on the 74th place with Title Population Count 2000. The overlaying order of maps will affect the final output, to make the combined country borders more pronounced we will make the color-filled map as the top layer and place the country border one beneath it.
3. To do so, go to map Population Count 2000 (74th place), check the Show checkbox on this row. Keep mouse click pressed right on number 74 in first column, and drag this map all the way up to the top of the map list. Note that when you drag it up a blue horizontal bar will show up to indicate where the map will be placed.
4. When done, the map list will be as the following:
5. Click OK button to close the Options dialog. Now you can click Preview button on the bottom left to preview the combined map.
7. Click OK button to close Maps Online dialog and load map.
Placing the Map on XY Plane
Now we want to place this map on the XY plane and later overlay 3D bars that shows country population on top of it. To do so, follow the steps below:
1. Right click on the thumbnail of map on the top left of matrix window and select Add to add a new matrix object.
2. Right click on the thumbnail of the added matrix object and select Properties to bring up Matrix Properties dialog.
3. Set the Data Type under Options node as Double(8). Then click OK button to close the dialog.
4. With the added null matrix object highlighted, click on the 3D Colormap Surface button on the 3D and Contour Graphs toolbar to create a color map surface plot.
5. Double click on the surface plot to bring up Plot Details – Plot Properties dialog. With the plot node highlighted on the left panel, go to Surface tab and check Shift in Z by percent of scale range, 0 = bottom, 100 = top checkbox under Display group to bring the map down to the XY plane.
6. Then go to Fill tab and check Fill piece by piece radio box. Then click its drop down option, go to By Points tab and select Direct RGB: Mat(1): “wms.png”.
7. After that go to Colormap/Contours tab, uncheck Enable Contours checkbox on the middle to disable contours.
8. Go to Mesh tab, and uncheck Enable checkbox to disable mesh grid lines.
9. Highlight Layer1 node on the left panel and go to Size/Speed tab, uncheck Matrix data, maximum points per dimension under the “Speed Mode, Skip Points if needed” group to turn off Speed Mode.
10. Go to Axis tab, set Link Axis Length to Scale (isometric) to be XY so that axis lengths are directly related to the axis scale (length of longitude axis is about twice the length of latitude axis).
11. Go to Planes tab, uncheck YZ, ZX checkboxes to turn of YZ, ZX planes. Then click OK button to close axis dialog.
12. Since we do not need axis labels, axis ticks, axis lines, axis titles and color scale, we can simply select them and hit Delete key to delete them.
Adding 3D Bars to the Map
Next we want to add the population of different countries to the map as 3D bars and optimize the size and orientation of the graph to make it more attractive.
Adding 3D Bars
2. Click the drop down option on the top left to select Worksheets in Folder. Click to highlight appeared Population (Long Name) row and click the down arrow button on the middle and select 3D-Bars, then click the right arrow to add it to the right panel.
4. Now we want to customize the 3D bars so the bar size is suitable, color is red and the country labels are added to the top of each bar.
5. Double click on any of the black bars to bring up Plot Details – Plot Properties dialog. Set Color under both Border and Fill groups as Red.
6. Go to Outline tab, drag the handle of Width (in %) to set it as 12 to set bar size.
7. Go to Label tab, check Enable checkbox, set font Size as 14, check White Out checkbox, set Label From drop-down option as Col(A): “Country”, set position Z as 200 and Rotate (deg.) as 90.
8. We should see the following graph:
Resize and Position the Graph
Now we need to resize the plot and change the perspective to a better angle.
1. Drag the graph window edge to enlarge the graph window.
2. We need to reduce the axis length along Z axis to make the bars of India and China look not so pronounced. To do so single click any white space (other than the red bars) inside the plot, a toolbar with 4 buttons will appear. Click the second Resize button, in the appeared XYZ coordinate tool drag the blue square handle downwards to shrink the bar size along Z direction.
3. Now we want to enlarge the plot inside the cubic frame to optimally occupy the graph page. Single click inside the cubic frame so the eight blue handles of the layer will appear. We can see that even if we can drag the blue handles to the edge of graph page, the plot still cannot fully occupy the space. For this situation, we can zoom out the graph page firstly by holding Ctrl key and scrolling mouse wheel backwards and then drag the blue handles of layer to resize the plot properly.
4. After all set, we can hold Ctrl key and scroll mouse wheel forward to zoom the plot back in, and click on the zooming and panning tool button docked on the left to pan the graph to a proper position.