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.
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:
dwg2bmp, dwg2png, dwg2jpeg, dwg2tiff, dxf2png, dxf2jpeg, dxf2tiff
and the awesome:
dwg2maptiles and dxf2maptiles
Using this tool, they came up with a beautiful sample using leaflet.js: http://qcad.org/res/map/
The project is OpenSource, but this scripts are only avaliable at QCAD Professional edition. You can use the free open source QCAD Community Edition by downloading the trial version for your platform (Win, Mac, Linux) and then remove the QCAD Professional add-on running in trial mode. Alternatively, you may compile your own package from sources.
PS: I'm very happy to support the project buying a professional copy.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With