3

I would like to display rich maps contained in Autocad .dwg files in my Android app. I'd like to know if there is an existing java library to do so?

If not, is it doable to translate a dwg file to a model and draw that model shape by shape on the screen?

I can't use Google maps instead of these files. The whole point of the app is to display a map with a lot of data and all that data is contained in my autocad files library.

Besides, is there an alternative format to DWG that I could use to do exactly this? (UPDATE: would SVG do the trick?)

Romain Piel
  • 11,017
  • 15
  • 71
  • 106
  • I hate to state the obvious - but what about AutoCAD WS? – Origin Mar 20 '12 at 16:16
  • AutoCAD WS is an app, isn't it? I'd like to find a library or another way to integrate my data in my own app. – Romain Piel Mar 20 '12 at 16:24
  • The real question is what is your source data and where is it coming from? You can export an SVG from AutoCAD, but it would require some tweaking as it is not very good with lineweights. Again though - this assumes you're exporting from AutoCAD, at which point DXF might be a better depending on which open libraries there are. – Origin Mar 21 '12 at 04:15
  • The source data was created in Autocad. They are maps of buildings and other objects. Every files are in dwg format. – Romain Piel Mar 21 '12 at 15:11
  • But do you actually need the device to do the interpretation? Or do you just need to convert the data once and then let them use that in the program? – Origin Mar 22 '12 at 01:51
  • The app will have static data and the user won't be able to add his own files. I don't want to use a specific format. All I want is to do the interpretation of these files in my app. – Romain Piel Mar 22 '12 at 09:55
  • I'm not sure exactly what you are looking for, but AutoCAD exports pretty well now to PDF and something waning called DWF. – Tom Haws Mar 23 '12 at 03:09

2 Answers2

1

What I ended up doing is to convert all my files in KML. I've selected this format because it might be the most used format on Android to do GIS.

To make a custom map, I'm drawing overlays on a mapview using these hints. It's basically the most interesting solution. I don't need to pay attention to geolocation stuff, the cursor and the scale are manage by Google API itself.

Community
  • 1
  • 1
Romain Piel
  • 11,017
  • 15
  • 71
  • 106
  • KML/geoJSON are interesting formats for drawing DXF graphics as long as you use light DXFs. When you start having custom shapes (objects or trees for instance) KML and geoJSON grow exponentially in file size and complexity. SVG may be a better solution for heavy files. There are ways of drawing SVGs upon maps or even turn them into rasterized map tiles if drawing performance is an issue – Rayjax Mar 23 '16 at 10:29
  • Hello, i know this thread is too old. But I want to make an app that will import a dwg file or any file from autocad that will read it and compute the cost of the things inside the dwg file. Is this possible? – Trafalgar Sep 01 '17 at 03:10
0

If you're going to convert I'd probably suggest DXF. I haven't used it, but YCad is a java DXF library. There are also a number of DXF to SVG converters available but it's probably best to avoid two conversions.

JayP
  • 809
  • 7
  • 9
  • Thanks for your answer but I don't think I'll be using YCad. Last commit was long time ago (2003-06-05). I'll investigate a bit more the dxf idea. – Romain Piel Mar 21 '12 at 14:27