TransWikia.com

What coordinate system is this? How can I project it to WGS84 (lat-long) system in Python?

Geographic Information Systems Asked by Rahul Choudhary on May 20, 2021

I had an AutoCAD drawing of a floor plan. I imported it to python using Fiona and checked the metadata. The CRS is empty. When I checked the coordinates for the geometry, it was in the following form,

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "id": "0",
        "properties": {
            "A-WALL__ID": null
        },
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [5319.568084840497, 5864.945849450571, 0.0],
                [5319.568084840497, 5882.945849450571, 0.0]
            ]
        }
    }, {
        "type": "Feature",
        "id": "1",
        "properties": {
            "A-WALL__ID": null
        },
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [4767.568084840497, 5863.945849450571, 0.0],
                [4767.568084840497, 5882.945849450571, 0.0]
            ]
        }
    }
]
}

I imported the AutoCAD file in following way,

c = fiona.open("level0dwg.dxf", 'r')
c.meta

Following was the output,

{'driver': 'DXF',
 'schema': {'properties': OrderedDict([('Layer', 'str'),
               ('PaperSpace', 'int'),
               ('SubClasses', 'str'),
               ('Linetype', 'str'),
               ('EntityHandle', 'str'),
               ('Text', 'str')]),
  'geometry': 'Unknown'},
 'crs': {},
 'crs_wkt': ''}

I am confused as in what is this coordinate system. Is it pixel-based or something like that?
and how can I transform it to WGS84 system with lat-longs to place it on the map?
The AutoCAD file is not georeferenced.

Is there a way to do this in Python?

I want to georefer the DWG file to place it on the map using Python. I have been stuck at this issue for quite some time now.

2 Answers

Do you know where the model should be located? That would be helpful. It could be a Gauss- Krüger coordinate system. It happens often that AutoCAD models use a normal local coordinate system without any CRS relation. In that case you must do a reprojection knowing the right "global" orign.

Answered by DG85 on May 20, 2021

The coordinate system could be anything. It could be a local coordinate system, it could be simply nothing, other than a drawing in meters/feet.(or cms, who knows).

Georeferencing would need a lot of information about the drawing, including units, dimensions (ie: Is it a rectnagle or a square? Rotation? Is it aligned north/south. who knows. That makes achieving that in python very difficult. In order to georeference the drawing, you will need known control points to align points in the drawing to. Here for reference https://docs.qgis.org/2.18/en/docs/training_manual/forestry/map_georeferencing.html

I would personally abandon the idea of georeferencing using code, and simply find out what coord system the drawing was captured in. It is actually really easy for an AutoCAD user to capture a coordinate system for a drawing. https://knowledge.autodesk.com/support/autocad-map-3d/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/MAP3D-Use/files/GUID-8A02D384-B075-4459-8E23-ED7D1C0F3D8F-htm.html

They should be doing this as part of their drawing managament, even for buildings/floorplans.

If you can't you might be better off manually georeferencing using the method linked above in QGIS. Given that its a floor plan, of which I assume an existing building, you may be able to do this based off of an aerial photo or similar. Depends on the scale/size of the building etc.

Answered by nr_aus on May 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP