Rendering large DWG files as such has shown performance degradation to large extent. Planning to use the concept of map tiles using leaflet. Need some pointers/information on how to convert DWG files to map tiles.
AutoCAD drawing (DWG) to map tiles
6.7k views Asked by Shanadas AtThere are 2 answers
The easiest approach may be to save your DWG files as PDF and use MapTiler to create the raster tiles and leaflet viewer for you.
You can render such PDF by drag&drop into MapTiler while choosing the "raster" profile - just follow the video tutorial: https://youtu.be/9iYKmRsGoxg?list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay
If you need to assign coordinates for later on placing markers or polygons on specified position over the DWG tiles - it is possible with advanced tiles.
If you need help with using MapTiler - write details and provide sample file you need to process to https://www.maptiler.com/support/community/.
If you data are sensitive or you need a guarantee on the answering of your request you seek directly the support from us, the authors of MapTiler.
After too many hours, searching everywhere for a solution to convert DWG/DXF files using any automated command line tool, finally I found QCAD.org.
And that works even on Windows, MacOS and Linux.
After a quick look in documentation, I found the section for command line tools.
They are:
and the awesome:
Using this tool, they came up with a beautiful sample using leaflet.js: http://qcad.org/res/map/
PS: I'm very happy to support the project buying a professional copy.