Welcome, Guest
Username: Password: Remember me

TOPIC: Looking for guidance with a GIS project.

Looking for guidance with a GIS project. 4 months 3 weeks ago #30

  • chris
  • chris's Avatar
  • OFFLINE
  • New Member
  • Posts: 10
Hello. I am new to this forum and to GIS generally. I am writing here in the hope of some guidance with a project that I am currently pursuing; I am trying to find a simple way of taking Ordnance Survey opendata (terrain 50 Esri shapefile) and producing from it a raised relief 3d map, using a CNC router.

I am not familiar with GIS software but am happy to put the time in to learn how to use it if it can perform this task for me.

So the task, as far as I have worked out so far (correct me if necessary please), is to take the relevant shapefiles for the area I want, stitch them together using geo-referencing tools, play with the borders and scales, then export the data as a DXF(?) file to send to a CNC router which will then machine the model.

The trouble is that I haven't much idea as to how to achieve the above using GIS software. Perhaps some kind person here could outline the basic sequence of steps (without too much jargon please) and then I will put the study in, learn how to use the relevant tools in QGIS and hopefully achieve my goal.

Many thanks in advance for any guidance.

Chris
The administrator has disabled public write access.

Looking for guidance with a GIS project. 4 months 3 weeks ago #31

  • Nighthawk
  • Nighthawk's Avatar
  • OFFLINE
  • Moderator
  • Posts: 17
  • Thank you received: 4
Hello Chris, and welcome to the forum.

This is a very interesting question, which I wouldn't mind researching a bit myself. I don't have the answer yet, in fact, I have a few questions for you first:

  • Does "Terrain 50 Esri shapefile" refer to 50 meter heightcurves? Or a grid file with points?
  • Can you please upload a sample shape file (or files), so I can do some testing?

Although QGIS strictly speaking is a 2D program, I believe it also has a few 3D options and functions. It will be interesting to see, if this can be achieved!

Please zip the files before uploading. Maximum file size is 5 MB.

Nighthawk
The administrator has disabled public write access.

Looking for guidance with a GIS project. 4 months 3 weeks ago #32

  • chris
  • chris's Avatar
  • OFFLINE
  • New Member
  • Posts: 10
Hello Nighthawk. Thanks for taking the time to reply. To answer your question, the shapefiles are supplied as 50m grid or 10m contours. I have the 10m contours.

The file attached represents a 10km a 10km mountain area. I wish to create a 3d surface model with this data, then export the data in a format (DXF maybe)that can be used by the CNC router.

At the moment I am struggling to even open a shapefile in qgis, let alone do anything with it.

Any help much appreciated.

Chris
The administrator has disabled public write access.

Looking for guidance with a GIS project. 4 months 3 weeks ago #33

  • Nighthawk
  • Nighthawk's Avatar
  • OFFLINE
  • Moderator
  • Posts: 17
  • Thank you received: 4
Hmmm, there must be something wrong with the upload function, your file didn't make it. We'll have to take a look at that.

But it doesn't matter, because now I know what type of files you have. I have similar GIS data available here.

I will do some investigation, as soon as I have some free time, and then get back to you.

Nighthawk
The administrator has disabled public write access.

Looking for guidance with a GIS project. 4 months 2 weeks ago #34

  • Nighthawk
  • Nighthawk's Avatar
  • OFFLINE
  • Moderator
  • Posts: 17
  • Thank you received: 4
Ok, I have finished my investigations, and have come up with two possible solutions.

The first solution I'll give around 30%, that it will work with your CNC router. The second 95%!

Solution 1: Using ogr2ogr with -zfield switch

OGR is opensource, and belongs to the GDAL project. OGR is used for reading and writing of different file formats, such as Esri SHP and AutoCad DXF.

I believe that QGIS internally uses ogr2ogr for it's import and export functions. Because of this, it should be possible for you to load the Shapefile with contours in QGIS, right click on the layer and say "Save As...".

Further, if you just want to use a certain area of your contours, you can also select those contours, using the "Select Features" tool, and then select "Save Selection As...".

In the "Save vector layer as..." dialog that pops up, select "AutoCAD DXF" as your format. In the "Data source" text box, under "OGR creation options", type "-zfield your_z_field". If you are unsure of the name of the field, right click the layer and select "Open Attribute Table". You'll find it quickly there.



In case this way of using QGIS as frontend for ogr2ogr does not work, there is always the option to do it manually using the command prompt. Follow this tutorial to try that. It does state, that it is not possible to do in QGIS, but I suspect it might be a limitation of 1.8, and not 2.0.

The problem with this solution, however, is that your DXF file only contains contours, and not an actual 3D surface (3D Mesh). I doubt the CNC router can make a model, based on only lines with Z values.

Solution 2: Using QGIS and Blender together

Blender is a quite advanced, opensource 3D modelling application. Personally, I used to work with 3DS MAX back in the day, but since installing Blender about a year ago, I have been totally sold.

This solution might have a steep learning curve, but if you manage to master it, the reward will be great!

So, here we go. First download and install Blender.

There are many tutorials all over the internet about getting started with Blender, so I will not go into details about this.

The main idea of this solution, is to save your contours in QGIS as a Esri Shape file, and then import the Shape file into Blender. From there we will triangulate the contours into a 3D mesh. Once that is done, it will be possible to export the mesh to DXF from Blender, for use by the CNC router program.

As default, Blender will not read Esri Shape files. However, there are many user created plugins, that you can install for Blender. One of them reads Shape files. Using it you can specify, which field has the Z value, so that contours get the correct height.

With this plugin, it is even possible to import shapes/polygons (e.g. buildings), and specify the height field for them. These will then be created as 3D objects, according to the values in the Shape file.

Download the plugin here, unzip it and put it in the Blender plugins folder.

Also, Blender does not have a triangulation function by default, so we need a plugin for that as well. Download it here, and likewise put it in the Blender plugins folder.

Now, for this tutorial, I will be focusing on the island of Nólsoy, here in the Faroe Islands, as shown in the following image:



I select the contours of the island, right click the layer in QGIS, select "Save Selection As..." and choose "ESRI Shapefile". Then in Blender, I click "File -> Import -> Shapefile (.shp)".

If you are missing the Esri Shapefile import option in Blender, click "File -> User Preferences". Click the "Addons" tab in the top. Now type "Esri" in the top left field, that has the magnifying glass. In the middle of the dialog, it should now say "Import-Export: Import/export from ESRI shapefile file format (.shp)". Check the checkbox to the right of the text, close the "Blender User Preferences" dialog, and try again.

In the import dialog that pops up, navigate to your Esri Shapefile. Check the "Elevation from field" checkbox on the left, and type in the name of the field containing the Z values. Press "Import SHP" on the top right, and your view should look similar to this:



You can try rotate the view, to make sure the contours indeed are 3D:



The contours will all be part of the same mesh. Select the countours and click "Triangulation" in the left side of the Blender interface (remember to activate the triangulation plugin in the "Blender User Preference" dialog, in the same way as with the Shapefile importer. This time type "Delaunay" in the search field, and check the checkbox).

Now your view should look something like this:



At this point, it should be possible for you to click "File -> Export" and select AutoCAD DXF. I believe this plugin is built in to Blender, but like with the other plugins, you might have to activate it in the User Settings dialog first. There are other formats, that might work with your CNC router as well, such as STL.

So there you go - easy as pie! :)

Here is a rendering of the island, where I put some texture on the terrain, and created a sea around it, just for shits and giggles:



Hope this helps you. Feel free to ask, if you get stuck somewhere.

Nighthawk
The administrator has disabled public write access.
The following user(s) said Thank You: chris

Looking for guidance with a GIS project. 4 months 2 weeks ago #35

  • chris
  • chris's Avatar
  • OFFLINE
  • New Member
  • Posts: 10
Nighthawk you are a star. I will follow your tutorials and see if I can replicate your success. Many thanks for taking the time to work this out for me.

Chris
The administrator has disabled public write access.
Moderators: PeterK
Time to create page: 0.274 seconds
QGISFORUM.ORG