https://github.com/suizer98/pydxf
An api helps to convert dxf & dwg files into geojson or shapefiles format that can be displayed on web gis
https://github.com/suizer98/pydxf
Last synced: 4 months ago
JSON representation
An api helps to convert dxf & dwg files into geojson or shapefiles format that can be displayed on web gis
- Host: GitHub
- URL: https://github.com/suizer98/pydxf
- Owner: Suizer98
- Created: 2023-10-05T08:53:53.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2026-01-02T02:32:08.000Z (6 months ago)
- Last Synced: 2026-01-07T16:47:00.963Z (5 months ago)
- Language: Python
- Size: 25 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Pydxf & Pydwg
[[_TOC_]]
## Description
Convert DXF and DWG engineering CAD files to GeoJSON and Shapefile formats for web GIS applications.
This project provides a microservice API for on-demand conversion of CAD files.
Tech stacks:

### Features
- **DWG Support**: Convert DWG files using Aspose.CAD
- **DXF Support**: Convert DXF files using OGR
- **Output Formats**: GeoJSON and Shapefile
### API Endpoints
1. **Upload**: `POST /pydxf/upload` - Upload DXF or DWG files
2. **List Files**: `GET /pydxf/files` - List uploaded files with download links
3. **Download GeoJSON**: `GET /pydxf/geojson/download?filename=file.dxf` - Download as GeoJSON
4. **Download Shapefile**: `GET /pydxf/shp/download?filename=file.dwg` - Download as Shapefile (ZIP)
### How to use
1. Go to [http://localhost:8000/docs](http://localhost:8000/docs) for Swagger UI, or go to [http://localhost:8000/scalar/](http://localhost:8000/scalar/) for Scalar API documentation
2. Upload DXF or DWG files using the upload endpoint
3. Download converted files using the download endpoints
4. Files are stored in `data/Files/` and converted outputs in `data/Output/`
### Local development
Start the service:
```bash
docker-compose up --build
```
The API will be available at `http://localhost:8000/pydxf`
### Dependencies
- **Aspose.CAD**: For DWG to DXF conversion
- **GDAL/OGR**: For DXF processing and GeoJSON/Shapefile output
- **FastAPI**: Web framework
- **Docker**: Containerization
### Code formatting
Format code with *black*:
```bash
docker exec pydxf black .
```
Check code quality with *flake8*:
```bash
docker exec pydxf flake8 .
```