If you're reading this, we've just migrated servers! If anything looks broken please email dion@thinkmoult.com :)

BlenderGIS import

edited May 2021 in General

Hi Guys,
I can't really figure out how to use BlenderGIS and to get a decent DTM (meshes and contours) without using additional costly software. Terrain data for NL is typically stored in raster files Geotiff. Some operations can be done with Qgis and CAD software, retrieving point data and some vectosization. But is seems that BlenderGIS can only work with ERSI SHAPE files. Isn't this a bit odd? I always thought ESRI .shp is a proprietary file format for GIS, like what 'Autodesk dwg' is in the world of CAD. Where is FOSS in this?
__
The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products.[1] The shapefile format can spatially describe vector features: points, lines, and polygons, representing, for example, water wells, rivers, and lakes. Each item usually has attributes that describe it, such as name or temperature. __

https://en.wikipedia.org/wiki/Shapefile

Result of Geotiff, converted to shp after vectorisation. No mesh created.

Comments

  • edited May 2021

    In order to get dtm from those shapes you must use delaunay triangulation. As Esri .shp format is "industry standard" i guess any serious alternative must be able to import it.
    In blender context "mesh" does not always mean "faces", they may contains only vertex and edges (as your import). Depending on what Delaunay triangulator expect as input, you may either convert to curve or to mesh.

  • @magicalcloud_75 it is good and bad to see you are still trying to solve this problem and get functional contours! It reminds me that I need to write up a tutorial for the wiki. I assume you still remember this conversation https://community.osarch.org/discussion/comment/583/#Comment_583 where rather than importing the contours you import the GeoTiff directly and them use cleanup to simplify the mesh.
    What are the particular issues you are having with the results?
    It is not surprising that Shapefiles are the only vector format that BlenderGIS supports it has been the dominant GIS format for decades and is an Open Standard*. I would compare it to DXF more than DWG. It is a very well know format that can be extended with sidecar files. It also has a twitter presence worth following https://twitter.com/shapefiIe .
    Both Esri and the FOSS community are very active in trying to replace it as the dominate file type. http://switchfromshapefile.org/ with Geopackage as the favored replacement by open source advocates. Although I have had some problems with geopackages and my file syncing system because they are based on SQLite.
    *https://gis.stackexchange.com/questions/142961/what-does-it-mean-that-shapefiles-are-mostly-open-specification

    magicalcloud_75
  • @magicalcloud_75 by the way, if you want to turn contours into a mesh (instead of @baswein 's suggestion of going via GeoTiff), BlenderGIS has the "Delaunay Triangulation" option as @stephen_l mentioned. Select the contours, then you can find the option here:

    Gorgious
  • Creating a mesh from contours using Delaunay Triangulation is fine for most purposes but in my experience you end up with artifacts in many cases including the contour lines being very visible in the mesh and drainage channels being stepped. Here is an excellent article on some of the issues. https://grasswiki.osgeo.org/wiki/Contour_lines_to_DEM

    Moult
  • @baswein ahh, very cool, I had no idea that was the case but it makes perfect sense!

  • @Moult - The drainage channel issue can be overcome fairly easily with break-lines. But I don't think BlenderGIS has that capacity (better than terrains from Contours in Revit though). But if you already have a DEM with higher quality terrain I would stick with that.

  • edited May 2021

    Archipack's terrain implements a unique solution for "oversampled" data along contour lines - wich is a common issue - by filtering input points by distance.
    While you'll loose small details often irrelevant as you only have density along one "axis" - huge points density on much spaced lines -, triangulation will be way more regular and clean (also with the ability to create simplified geometry of the same terrain) and mostly avoid triangulation artefacts like "steps".
    Undersampling by distance also allow quite fast delaunay even on pure python delaunay fallback (qgis based), if the dataset is more than 500k points you should rely on scipy delaunay as it is up to 18x faster.

    CloudCompare provide an alternative for fast delaunay.

    tlangbasweinMoult
  • edited May 2021

    Thank your for the tips. I will look into them. It would be very usefull to have a demo, youtube how Contour_lines_to_DEM with Grass works in practice. I am exploring aternatives for 'low cost' and effective digital terrain modelling for simple uses. This rules out an number of software solutions out there, that in my opinion are very costly and work 'locking in' data.

    baswein
  • SHP export of contours from QGIS and BlenderGIS certainly is a way forward.

    baswein
  • Made a small YouTube demo for even more Blender nitwits. :P

    Moult
  • edited August 2023

    @magicalcloud_75 et al., it is 2023 now. Without importing any data is it possible to use BlenderGIS to generate and export the mesh results to .shp (with the right DEM (spot levels))? After using the "Get Elevation (SRTM)" from the Basemap to generate the mesh I tried to export from BlenderGIS to .shp expecting to see the elevation of the points;

    But when I query the Attribute Data in QGIS everything is 0 as displayed below;

    I even opened the .dbf (that comes with the .shp export) in Excel and the point values are all zero. Is it like nothing has changed much since the
    2021 discussion here?

    atomkarinca
  • Hi @magicalcloud_75,
    I am a bit late for the discussion, sorry. But if you are willing to use sverchok, you could use mega-polis to do that. You can load geotiff directly on that and get the mesh output.
    I still have to provide tutorials and documentation on how to do it.

  • I have don't have a problem exporting terrain as points with elevations. I think what you are seeing is the obj id that seems to all be encoded as 0 when you export. The elevations are baked into the geometry. If you take the Identify Features tool in QGIS and select a point you should see a z value.


    If you want to have this as an attribute in your attribute table you can run Extract Z values in QGIS which create a new file with an elevation field included.

    Owura_quGorgious
  • edited August 2023

    @baswein said:
    If you want to have this as an attribute in your attribute table you can run Extract Z values in QGIS which create a new file with an elevation field included.

    Your response has really been helpful and I didn't know that functionality since am still getting to know QGIS! How do I extract the X and Y values along with the Z values in the same table? Also, my X and Y values came in degrees but I need them to come like in your case (what am seeing in your X and Y are the Eastings and Northings format I guess). Thanking you in advance.

  • Glad it helped. You can use the field calculator
    to create x and y fields. In the picture I am creating a field called Easting which uses the x(@geometry) formula to calculate the x value.
    .
    This will be in the units of the coordinate system of your point layer. If that is Lat/Long you will first need to Reproject it into a different coordinate system that has the units you want. You should be using a local coordinate system. Here I am using 3586 which is made for Massachusetts and has feet as it's units and am reprojecting to 3585 that has meters as it's units.

    Warning! The fields are static text so if you move a point it will not update your Easting and Northing fields unless you recalculate them.

    atomkarincaOwura_qu
Sign In or Register to comment.