Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

ezdxf -- transform EPSG 3395 latitude longitude decimal degrees coordinates to WCS coordinates to save revised DXF file

$
0
0

All entities in the tester DXF are either TEXT or LWPOLYLINE.

My goal is to transform all LWPOLYLINE and TEXT entities in all layers in the DXF recursively from EPSG 3395 (latitude longitude in decimal degrees) to WCS coordinates, and then save that revised DXF file as a new file.

In order to do so, should I use crs_to_wcs or globe_to_map? Is there a good example that shows the steps?

Below is the python code modified from the ezdxf documentation:

import ezdxffrom ezdxf.math import Matrix44from ezdxf.addons import geodoc = ezdxf.readfile("tester.dxf")msp = doc.modelspace()# Get the geo location information from the DXF file:geo_data = msp.get_geodata()if geo_data:    # Get transformation matrix and epsg code:    m, epsg = geo_data.get_crs_transformation()else:    # Identity matrix for DXF files without geo reference data:    m = Matrix44()    epsg = 3395

Viewing all articles
Browse latest Browse all 14215

Trending Articles