I have a dxf file and use this tool to convert it to shapefile.

Then I apply some affine transformations and get a shapefile that does not fit the shapefiles downloaded from osm (EPSG:4326).

I know that I have to reproject the shapefile using ogr2ogr, but as I began with no clue of what was the original CRS, how can achieve the desired result of all districts in green of the picture on the right to fit as the magenta ones on the left one?

Cordoba province on CAD (dxf) at left, and shapefile after affine at right


2 Answers 2


If you want the shape fit to the OSM data, you have to know the projection of your dxf file.

To get an idea, could you post the extent of the coordinates and a sample point, e.g. from the rectangular border lines edges at the bottom of the map, both in the dxf file and in OSM lat/lon?

The OSM data is unprojected (that is, not in metres, but in degrees). That's why the data would not fit automatically or with affine transformations.

  • Thanks, but then why on osm extracts is specified EPSG:4326? Mar 22, 2013 at 22:43
  • Because OSM stores all geographic data in lat/long degrees. It is no problem to create a shapefile with that CRS, and reproject it to another CRS using metres as units. I use Qunatum GIS for such operations.
    – AndreJ
    Mar 23, 2013 at 6:12
  • Thank you Andre. The extent of coordinates of the picture is aproximately -61.50, -29.40 to -65.90, -35.20. I don't know how to determine a coordinate based on the linestring field of a database... The little square of the upper center is at -31°25′ -64°11′. Mar 25, 2013 at 21:30

Project your OSM data to a cartesian coordinate system (e.g., a UTM), which enables you to apply an affine transformation on your data.

It's not mandatory that you know the reference system of the vector file. You will take the projected OSM data as reference anyways.

Now follow the steps I wrote in the answer to this post which describe the process of applying an affine transformation, from picking control points to entering parameters to the QGIS plugin Affine transformations.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.