2

A client of my company has asked us to add a CAD file to a WMS. We have a subcontracted IT company that will adress the WMS part, but we need to provide them with a geoJSON of our client's CAD file.

I have managed to transform the provided .DXF file into a shapefile but it seems I am not able to convert that shapefile into a raster properly. I need to do this step in order to georeference the raster and then export it as a geoJSON.

The problem is the following (please understand that I'm not a programmer and I have little to no knowledge in linux commands), using GDAL tools within QGIS, specifically gdal_rasterize. I give the program an input file, create a new output raster with resolution 1,00 horizontal and 1,00 vertical which gives me the following command:

gdal_rasterize -tr 1.0 1.0 -l 70080-00-ytg-mda-tr-001 <input_filename> <output_filename>

First of all QGIS throws an error telling me that I must input an extra parameter, shall it be -burn, -a or -3d. I don't know how any of this commands work, but after a little online research, I add -burn 0 so the code becomes the following:

gdal_rasterize -burn 0 -tr 1.0 1.0 -l 70080-00-ytg-mda-tr-001 <input_filename> <output_filename>

Then, the disk's free space is not enough (which is not true). Again, a brief online research tells me to add this at the end of the command:

--config CHECK_DISK_FREE_SPACE NO

Then the process finally starts doing something, but after a few seconds it stops and a new error appears: "The process was interrupted a while after starting correctly" (may not be the exact words, as I am a spanish user, I translated it).

I am given an output file but it is corrupted, and at this point I don't know how to continue or how to fix the error. I hope there is someone kind enough to give me a solution or guide me through the learning process of doing so myself.

  • If you know the SRS/CRS of your DXF - you can use ogr2ogr to directly and correctly transform it to GeoJSON. (gdal_rasterize is not required at all.) – Ralph Tee May 11 '18 at 16:05
  • The problem you faced with gdal_rasterize is because you did not specify which band you want to burn your vector objects, and with what value (0 to 255). – Ralph Tee May 11 '18 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.