0

I am building a facility management app. I have been given a .DWG file of the floor plan that I want to show on the app and make the desks and chairs clickable so that employees of that facility can book it. Much like how you would book a seat in a plane by clicking on the seat in the image.

I converted the file to an SVG. Initially the file size of the SVG after conversion was over a 100 Mb. So I cleared the layers in the DWG, converted it to an SVG and after compression, got the SVG size to 1.1MB. This hampered the quality of the SVG severely. On top of it, the app was still unable to open the SVG smoothly and kept crashing at times. This makes me think that converting to SVG is not the best approach. Any advice on how this can be done?

2
  • Unfortunately CAD files are notoriously complex and bloated. The main problem: CAD apps/formats will usually draw complex shapes like curves in thousands of separate line elements instead of a single bezier curve. To some extend you may try to concatenate these elements via SVGO - so you get at least one path element per shape. But you probably need many tries to find the best settings. You should also try to pre-process/cleanup the data in an graphic editor like inkscape to detect duplicate/excessive elements. Commented Jul 29, 2024 at 0:24
  • Noted. I actually found another way to render the SVG in a webview. It's showing up well now on the app. Just need to make it interactive now. Thanks for the response Commented Jul 30, 2024 at 0:11

1 Answer 1

0

Your SVG is still quite large and it might be useful to look into what happens at the moment the app crashes to make sure if its due to memory or something else in your code.

If futher simplification of the DWG layers to make the SVG smaller is not possible, I would recommend lookinging into breaking it down into smaller sections e.g. simple segmentation by loading the smaller sections as and when needed. You can also convert the DWG into vector tiles using tools like Mapbox or Tangram.

Alternatively, you can try rendering it on a canvas instead which might be better performance wise with graphics.

Sign up to request clarification or add additional context in comments.

1 Comment

Noted. I actually found another way to render the SVG in a webview. It's showing up well now on the app. Just need to make it interactive now. Thanks for the response

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.