Extract/create contour map/dxf using ODM

Hi ,
I ran odm using the docker in the repo and it created a bunch of output as given in the GitHub .
However I want to create a contour dxf file and PDF(of the same ) which I am not able to see in the outputs .

Can anyone please help me to know if there is a perimeter I have to pass while running the docker ?

Or how can I create it ?

Thank you . Appreciate your help

For the DXF you could use GRASS + this script (https://github.com/OpenDroneMap/WebODM/blob/master/plugins/contours/calc_contours.py) which you can execute directly in GRASS and is the same that WebODM uses to generate contours.

1 Like

Do I have to run it separately like you said ? Or it comes in docker .any way to plug it in docker ?

It comes separately, but you could include it in Docker by modifying ODM’s Dockerfile.

Thanks. . can anyone help me in installing GRASS for Ubuntu 16.04 ?
I did sudo apt install grass but when I import it in python it doesn’t work

Thank ,this community is really helpful

1 Like

An alternative approach may be to install QGIS, use the extract contours tool on the digital terrain or digital surface model raster. This will create the contour dataset, that can then be exported as DXF.

1 Like

What I understood after doing my research is GRASS has its own gui and in that you are suggesting to run contour.py (this is what I can relate)

Is there any way I can use grass with just an import in python (just like we do for other packages in python)

But what I want is to build a pipeline using docker which gives me Ortho and dxf file .

Also what would be the input to contours.py ,will it be DEM or something else


You can use GRASS as a scripting engine, without GUI. See https://grasswiki.osgeo.org/wiki/GRASS_and_Shell#Automated_batch_jobs:_Setting_the_GRASS_environmental_variables and https://github.com/OpenDroneMap/WebODM/blob/master/app/plugins/grass_engine.py#L104 for examples.


i tried the same using arcscene . the input was dsm and i used extract contour tool , it created a tiff file like this but i want something in 3d to be used with autocad .
1)can i do the same in arcscene using extract contours but in 3d ?
2)can the qgis be used with python ,so essentially i just have to use a python code that takes dsm as a input and gives me a contour dxf drawing .?

Use the link I posted above for QGIS and set Produce 3D vector and it will load as 3D vectors in autocad.


can the qgis be used with python ,so essentially i just have to use a python code that takes dsm as a input and gives me a contour dxf drawing .?

i want to automate it

There is a QGIS python API and a console if you want it to be easy to test out ideas: https://docs.qgis.org/2.18/en/docs/user_manual/plugins/python_console.html

Although looking at that link, you might want to search for the latest.

1 Like

You can use pyqgis, yes, or qgis console, which is a more recent command line-only interface to QGIS (3.10+, I believe)


does pyqgis comes in linux/ubuntu ?

also is there a way to use gdal for the same ?

It is built in to QGIS packages. Not sure what package version your distro has.

Most likely. Try looking at the documentation for GDAL.

1 Like

Yup. Depending on your distro, there is likely a package.

1 Like

Good morning , it has been a long time i did not implement the discussion in this thread , but finally this is what i will be doing please let me the step are correct or not .

  1. Take dtm from odm results and use gdal to convert it into contour shape file - (give elevation value in the command)
  2. Use gdal to convert contour shape file to autocad dxf report .

please suggest if this is the right approach . my end goal is to get a dxf 3d contour and visualize in autocad

something like this in 3d

Thank you

1 Like

so i am able to do the first step which is converting the output of odm which is dtm.tiff into contour.shp
1)my first question is is there any diff in output if we convert a dsm into contour.shp vs dtm into contour.shp

  1. ogr2ogr -f “DXF” /home/ubuntu/contours.dxf /home/ubuntu/datasets/project/odm_dem/contours.shp -zfield ELEVATION — i am using this command to convert shp file to dxf but i get this error
    Unable to open datasource /home/ubuntu/datasets/project/odm_dem/contours.shp' with the following drivers. -> PCIDSK’
    -> netCDF' -> JP2OpenJPEG’
    -> PDF' -> ESRI Shapefile’
    -> MapInfo File' -> UK .NTF’
    -> OGR_SDTS' -> S57’
    -> DGN' -> OGR_VRT’
    -> REC' -> Memory’
    -> BNA' -> CSV’
    -> NAS' -> GML’
    -> GPX' -> LIBKML’
    -> KML' -> GeoJSON’
    -> Interlis 1' -> Interlis 2’
    -> OGR_GMT' -> GPKG’
    -> SQLite' -> OGR_DODS’
    -> ODBC' -> WAsP’
    -> PGeo' -> MSSQLSpatial’
    -> OGR_OGDI' -> PostgreSQL’
    -> MySQL' -> OpenFileGDB’
    -> XPlane' -> DXF’
    -> CAD' -> Geoconcept’
    -> GeoRSS' -> GPSTrackMaker’
    -> VFK' -> PGDUMP’
    -> OSM' -> GPSBabel’
    -> SUA' -> OpenAir’
    -> OGR_PDS' -> WFS’
    -> SOSI' -> HTF’
    -> AeronavFAA' -> Geomedia’
    -> EDIGEO' -> GFT’
    -> SVG' -> CouchDB’
    -> Cloudant' -> Idrisi’
    -> SEGY' -> XLS’
    -> ODS' -> XLSX’
    -> ElasticSearch' -> Walk’
    -> Carto' -> AmigoCloud’
    -> SXF' -> Selafin’
    -> JML' -> PLSCENES’
    -> CSW' -> VDV’
    -> GMLAS' -> TIGER’
    -> AVCBin' -> AVCE00’
    -> `HTTP’

can anyone help me at this step please. thank you

1 Like

so i am able to run the following command now but it gives me this error
sudo ogr2ogr -f “dxf” /home/ubuntu/contours.dxf contour.shp -zfield ELEV
ERROR 1: DXF layer does not support arbitrary field creation, field ‘ID’ not created.
ERROR 1: DXF layer does not support arbitrary field creation, field ‘ELEV’ not created.

what is the error over here ???

1 Like

okay ,though it gives an error i can see the final dxf output . so it works

1 Like