Question: I'm working on openlayers and need to change the format of dwg to GeoJSON with ArcGIS.
how can i do this?

Answer: 
Even if [GDAL](https://gdal.org/) is a good and working solution for [DXF](https://en.wikipedia.org/wiki/AutoCAD_DXF) file (which are CAD files too)

Since the OOP asks about [DWG](https://en.wikipedia.org/wiki/.dwg) file, I would suggest to use the [LibreDWG](https://github.com/LibreDWG/libredwg) library that support conversion from DWG to GeoJSON files and has very good performance.

You can use it like so :

```
dwgread <input_file_path> -O GeoJSON -o <output_file_path>

```

There are also many other commands provided by this fantastic library.
I am also currently work on an open source project [Geofiles-convertor Rest API](https://github.com/sigolo/geofiles-api) which is a REST API that aims to make popular geofiles format conversion easier.
It is also based on both GDAL and LibreDWG and there is a Docker image ready to run.

### Windows Users

For Windows users, you can download the [latest release from GitHub](https://github.com/LibreDWG/libredwg/releases) *(win32.zip or win64.zip)*, which has `dwgread.exe` file.

You can then open a terminal in the downloaded folder location and run the command `dwgread.exe "D:\path\to\file.dwg" -O GeoJSON -o "D:\path\to\output.json"`
Possible that you also need to make match your coordinates from AutoCAD (if meter unit) to geojson (GPS coordinates).

* First: lambert 93 to select part of world area you aim.
* Second: 3 points to focus on affine transformations to adapt AutoCAD geometries (rotation, translation, scale).

You could have a look at this doc:
<https://github.com/open-indoor/openindoor6/blob/main/AUTOCAD.md>

Also, a solution for DWG to DXF (ODAFileConverter in unattended Docker):
<https://github.com/open-indoor/dwg-to-dxf>