The dwgmapconvert function does not work correctly

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
arvkonstantin
Newbie Member
Posts: 3
Joined: Mon Jun 06, 2022 11:27 am

The dwgmapconvert function does not work correctly

Post by arvkonstantin » Mon Jun 06, 2022 11:56 am

Hello!
I have a dwg file, in a custom coordinate system
1) I'm trying to get a bbox:

Code: Select all

~/opt/qcad-3.27.1-pro-linux-x86_64/./box my dwg.dwg
Min: 86570.32755488135/26382.722042818987
Max: 87223.29994185067/26679.722042818987
Size: 652.9723869693116/297
2) I'm trying to convert to 3857(mercator):

Code: Select all

~/opt/qcad-3.27.1-pro-linux-x86_64/./dwgmapconvert -crs-in='+proj=tmerc +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 + units=m +lon_0=78.05 +lat_0=0 +k_0=1 +x_0=4500000 +y_0=-11057.63' -crs-out='EPSG:3857' -o 3857.dwg mydwg.dwg
3) I will get bbox again (but already in mercator):

Code: Select all

~/opt/qcad-3.27.1-pro-linux-x86_64/./bbox 3857.dwg
Min: 75159.69594902138/25011.15057963294
Max: 4592719.404079856/30278.32675736996
Size: 4517559.708130835/5267.176177737019
As we can see the picture has become very large

4) Let's try to convert to 4326(WGS):

Code: Select all

~/opt/qcad-3.27.1-pro-linux-x86_64/./dwgmapconvert -crs-in='+proj=tmerc +ellps=krass +towgs84=23.57,-140.95,-79.8,0,0.35,0.79,-0.22 + units=m +lon_0=78.05 +lat_0=0 +k_0=1 +x_0=4500000 +y_0=-11057.63' -crs-out='EPSG:4326' -o 4326.dwg mydwg.dwg 
5) Take bbox from 4326:

Code: Select all

~/opt/qcad-3.27.1-pro-linux-x86_64/./bbox 4326.dwg
Min: 40.252429549924216/-0.7301427247460435
Max: 86740.4955602855/28105.466245804986
Size: 86700.24313073559/28106.196388529734
There can be no such values at all..

Conclusion:
Incorrect conversion to EPSG:3857 and EPSG:4326.

What else did I observe during the experiment:
1) If I open the source file in QCAD with a graphical interface, then there are hidden layers in it, which are located just somewhere here - 75159, 25011. Which hints that hidden layers are not converted to another coordinate system.
2) When trying to make all layers visible and try to save the file, a window is displayed that the old version of DWG (R15) is being used.
3) There are no problems with R24 and R27, but how can I solve the problem with R15?
4) There is another problem with R24 and R27. When converting it to EPSG:4326, the entire geometry turns into incomprehensible primitive wide circles. Is there a way to solve this problem?

Unfortunately, I can't attach the original vector files, as this is commercial information.

Thank you for any help!

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: The dwgmapconvert function does not work correctly

Post by andrew » Mon Jun 06, 2022 8:34 pm

Without the files, this is pretty much a shot in the dark:

Try segmenting your input into line segments, for example with:

Code: Select all

-segment-length=0.1
Please note that QCAD uses the PROJ4 library to convert between different CRS. The rest is just breaking up geometry into line segments and projecting. Your CRS information is passed "as is" to PROJ4. If your source drawing contains arcs or circles of significant sizes, definitely use segmentation with the switch above.

arvkonstantin
Newbie Member
Posts: 3
Joined: Mon Jun 06, 2022 11:27 am

Re: The dwgmapconvert function does not work correctly

Post by arvkonstantin » Tue Jun 07, 2022 9:40 am

andrew wrote:
Mon Jun 06, 2022 8:34 pm
Try segmenting your input into line segments, for example with:
Thank you, the result has become better

Post Reply

Return to “QCAD 'How Do I' Questions”