Estimate the height of unknown/interpolation points using IDW spatial interpolation method.īefore proceeding to the next step, please run the code.Defined an interval distance and populate interpolation points that cover the whole area.The surface function from Plotly library is used to construct a 3D terrain model.
How to 3d print terrain how to#
Please refer to my post about creating contour lines and IDW spatial interpolation for further explanation.įrom the explanation above, I'm sure you can grasp the main idea how to model a 3D terrain in Python. It can be used for creating contour line but not suitable for 3D topographic surface modelling. On the other hand, the linear interpolation can only interpolate at any location between two known points along a straight line that connected the two known points. I chose IDW because we can estimate an unknown point at any location and it's rather more simple to implement than Kriging method. Next question could be, how we estimate the height of interpolation points? There are many spatial interpolation methods available such as linear interpolation, Inverse Distance Weight (IDW) and Kriging. What about 1 m interval? how many points will it be? simply 100 x 100=10000 points.įigure 3. In total, the number of interpolation points will be 400 points (red dots) as shown in figure 3. Then we do interpolation every 5 m for both X and Y axis, so we have 20 points for X and 20 points for Y. From the survey, we took 50 measurement points (blue dots). One day, we did a topographic survey of a region with area 100 x 100 m. Let's take an example to make it more concrete and easy to understand. Then we populate more points that cover the whole region and estimate the height based on the measurement points, so we can model the 3D surface for the area that close to the actual condition. Why are there more points are required in creating 3D model and even getting thousands? In fact the point from field measurement many fewer that that? Actually when doing topographic measurement, what someone do is taking a number of sampling point appropriately in the surveying area. It renders faster, smoother and it can produce a html output with some tools that enabled us to zoom in, zoom out, pan, rotate, export to static image and so forth. It's hard to forget the first love, but really sorry I need to find something else.įinally after some adventures, I found Plotly library is a good one to model the terrain in 3D. Previously with a fewer points I can freely rotate it without any delay, but the terrain rendering became slower and needed longer time to compute when the surface is getting more complex with thousand points. But later on I found the output with Matplotlib was getting slower as number of point increasing. The first output from Matplotlib made me so happy, now I can make a terrain 3D model in Python. 3D terrain modelling with Matplotlib surface plot Figure 2 shows 3D terrain from Matplotlib's surface function.įigure 2. I found there are some functions to plot 3D model in Matplotlib such as wireframe, surface and trisurf. So firstly I used Matplotlib to model a terrain surface in 3D. I use it frequently to plot any graph I need. Matplotlib is the first graphic library I know when started learning Python. But before discussing how to do it step by step, let me explain briefly the story "behind the scene" until I come to this point. It took some times till I got a good one and decided to share the result with you. Repeat this step for different points to create interesting terrain features.Before writing this post, I had done some experiments with different technical approaches and results. Use the green arrow to move the box and thereby modify the height of the point. A box that represents the point appears on the design surface. In point selection mode, select one of the points, and then on the Model Editor toolbar, choose the Translate tool. Modify a point to create a terrain feature. On the Model Editor toolbar, choose Select Point. By creating more subdivisions, you can give the terrain even more detail.Įnter point selection mode. With the new faces still selected, choose Subdivide face two more times. This adds new vertices to the plane that split it into four equally sized partitions.Ĭreate more subdivisions. On the Model Editor toolbar, choose Subdivide face. In face selection mode, choose the plane once to activate it for selection, and then choose it again to select its only face. On the Model Editor toolbar, choose Select Face. In Select mode, select the plane object, and then on the Model Editor toolbar, choose the Frame Object button.Įnter face selection mode. To make the plane object easier to work with, you can frame it in the design surface.