Placing 3D Bars on a Map

posted in: Apps, Graphing | 0

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 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 DOC2694Pic2 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:

1. Click the DOC2694Pic2 icon on the right side of Layers option,you can see all the maps available from current map source. Note that only maps from same source can be combined.

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.


6. To load the combined map into Origin as matrix data, click this button Overlay_World_Map_on_Sphere_05 on the bottom left to bring up Load Into and Area options. Set Load Into as Matrix and make sure Area option is set to Auto. 


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

1. Double click on the layer 1 icon DOC2694Pic14 to bring up Layer Contents dialog.

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.


3. Click OK button to apply the setting and click the Rescale button Overlay_World_Map_on_Sphere_11 docked on the top right to rescale the plot to show the 3D bars.

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 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 buttonDOC2694Pic20 docked on the left to pan the graph to a proper position.

5. Eventually we can use the 3D rotation toolbar DOC2694Pic21 locate on the bottom to rotate the graph to a better perspective.



Leave a Reply