GeoTIFF support

Please use this forum to post feedback and suggestions related to QCAD.

Moderator: andrew

Post Reply
Svenne
Newbie Member
Posts: 7
Joined: Thu Apr 16, 2020 12:27 pm

GeoTIFF support

Post by Svenne » Fri Jul 18, 2025 11:10 am

Hi everybody,

I'm using QCAD Pro for about 5 years now within our company and just bought the recent version a few days ago. Overall, I am very happy with the simplicity and general functionality of the software, but there is one feature that I really miss that would make my work a lot easier:

I need to intergrate GeoTIFF files in my projects quite often, unfortunately when I import a GeoTIFF in QCAD it ist not georeferenced anymore, which means that I then have to manually move each image into its correct position and scale, which is quite a pain.

So a GeoTIFF file which keeps its inherent georeference would be an amazing feature for QCAD!

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: GeoTIFF support

Post by CVH » Mon Jul 21, 2025 3:52 am

Hi,

Here we tend to debate on suggestions or direct the user to an existing feature, provide a work around and so on.
But these topics may loose their general focus really quick. :wink:

The best place for a new feature request is QCAD Bugtracker.
You need to sign in with or apply for a new account what is unrelated to the QCAD forum account.

Since we can create Map Tiles from drawing data (Tutorial) it would indeed be beneficial that bitmap data could be imported correctly.

Because the GeoTIFF format is fully compliant with TIFF 6.0 it is simply imported as a bitmap.
The question remains if QCAD is really fit to use it as a GIS application.

I assume that one can extract the left lower position and scale by other means.
Then it should be as simple as adapting the Bitmap entity properties in the Property Editor after insertion.

Regards,
CVH

Svenne
Newbie Member
Posts: 7
Joined: Thu Apr 16, 2020 12:27 pm

Re: GeoTIFF support

Post by Svenne » Fri Jul 25, 2025 12:14 pm

Thanks for your insights, I'll do a new feature request via the Bugtracker!
Can I cite your post in the feature request? I think it would be beneficial since you clearly have a deeper understanding of the underlying technical side of it.

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: GeoTIFF support

Post by CVH » Sat Jul 26, 2025 5:17 am

Svenne wrote:
Fri Jul 25, 2025 12:14 pm
Can I cite your post in the feature request? I think it would be beneficial since you clearly have a deeper understanding of the underlying technical side of it.
Sure and no, not at all.
As follow up I read an article that explained the use of GDAL to extract spacial data from a sourced GeoTIFF file.
CVH wrote:
Mon Jul 21, 2025 3:52 am
I assume that one can extract the left lower position and scale by other means.
With the corner positions for example it should be possible to scale and place the bitmap correctly.
CVH wrote:
Mon Jul 21, 2025 3:52 am
The question remains if QCAD is really fit to use it as a GIS application.
Supporting the GeoTIFF format in full is much more than displaying a raster image or bitmap.
The raster itself is per definition not limited to orthogonal.

Regards,
CVH

bidon
Newbie Member
Posts: 3
Joined: Mon Aug 25, 2025 9:15 am

Re: GeoTIFF support

Post by bidon » Mon Aug 25, 2025 10:08 am

Hello,
I have been looking for this feature also. This would a good addition for gis/mapping/surveying needs, even if QCad is a cad, not GiS software.
Seems there is no official "one-click" solution, so I made it by myself.
You can find enclosed solution for placing GeoTiff images into current cad drawing. Test were taken on geotiff file along with tfw world file.
For georeference we need a raster file and a world file ( e.g. tif and tfw ) to be in the same directory.
As far as I can say - it works - faster or slower depending on image size, and could be adjusted and polished according to ones needs.

Instructions:

This QCAD add-on inserts georeferenced images using world files (.tfw, .jgw, etc.).
GEO.zip
(3.92 KiB) Downloaded 40 times
## Manual Installation

1. Go to `QCad > Scripts' directory ( I believe, the path for Windows could be a bit different )
2. Extract and paste 'GEO' folder
3. Restart QCAD ( rescan option for add-ons should be ticked in option menu, probably it is a default setting )

## Usage

- Use the new "GEO" menu or toolbar.
- Select "Georeferenced Image".
- Choose an image (e.g., `.tif`, `.jpg`) (matching world file will be chosen programmatically if in the same folder)
- Wait for results and information in console.

Regards,
bidon

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

Re: GeoTIFF support

Post by andrew » Mon Aug 25, 2025 12:53 pm

bidon: Many thanks for your valuable contribution. What license are you releasing this under? Could we include this script (in a slightly modified form) as part of future QCAD packages? We would place it in a "Misc > Geo" menu of QCAD.

bidon
Newbie Member
Posts: 3
Joined: Mon Aug 25, 2025 9:15 am

Re: GeoTIFF support

Post by bidon » Mon Aug 25, 2025 2:14 pm

Yes. Feel free for any needed modifications and improvements. Keep it open-source (GPLv3).

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

Re: GeoTIFF support

Post by andrew » Mon Aug 25, 2025 5:24 pm

OK, thanks.

May I ask if this script was generated with the help of AI?

Did you test it or do you have examples I can use for testing?

I'm not sure if the image is positioned correctly (angles and position of top left pixel). In any case, this could be a good starting point for importing geo-referenced images.

Thanks.

bidon
Newbie Member
Posts: 3
Joined: Mon Aug 25, 2025 9:15 am

Re: GeoTIFF support

Post by bidon » Tue Aug 26, 2025 7:58 am

Yes, I have used AI to get quick introduction into ECMAscript for Qcad (you can see the comments were generated during the process) However the results included many mistakes, so AI with 'step by step' approach and correcting gave better effect. The only problem was with the origin of coord system - for cad is left lower - for gis is left upper.
I have one 'test set', got from person with commercial cad. This is: georeferenced tiff - orthophoto image and a file with parcels boundaries.
Checked insertion point and angles and to me- it is correct. The image position on test file were as expected.
I can share those files, but the image itself is 82MB, so alternative way of sending would be ok.

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: GeoTIFF support

Post by CVH » Tue Aug 26, 2025 9:26 am

bidon wrote:
Tue Aug 26, 2025 7:58 am
The only problem was with the origin of coord system - for cad is left lower - for gis is left upper.
The origin of any drawing in QCAD is coordinate (0.0, 0.0 (,0.0)).
There is no left/right or upper/lower origin involved.

You probably mean that the insertion point of a bitmap is the left lower edge of the bitmap area.
It's not even about the location of the bottom left pixel.
CAD is vector based and a vector has no width, a point has no size, while a pixel has a certain size.
bidon wrote:
Tue Aug 26, 2025 7:58 am
I have used AI to get quick introduction into ECMAscript for Qcad. However the results included many mistakes.
I don't know of any well trained AI that can produce ECMAScript for QCAD at this moment.
Don't call it mistakes, it just flings out bogus code that looks like valid JavaScript to the untrained eye.

An example was given by Andrew: layer.isNull()
The AI didn't even lookup if isNull() is a method of the RLayer class in the QCAD API.
isNull() is also not a standard ECMAScript instruction or function.
The JS code is expected to throw an exception here.

!di or !imagePath are other examples.
If the content of di or imagePath can be considered as defined and thus truthy then the logical complement would be false.
Turns out that 'Undefined' or 'Null' are nullish and thus always falsy and the logical complement is then true.

All 3 cases should use the dedicated QCAD library function isNull(object) as if(isNull(...)) {...}.


I think that there is still a major difference with extracting the stored location directly from a GeoTIFF.

Regards,
CVH

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: GeoTIFF support

Post by CVH » Wed Aug 27, 2025 6:20 am

andrew wrote:
Mon Aug 25, 2025 5:24 pm
I'm not sure if the image is positioned correctly
The insertion point of the bitmap is set to (C, F) or (topLeftX, topLeftY).
topLeftY is in fact already replaced by 'bottomLeftY'
The world parameters C and F are said to be the center of the corner pixel.

In QCAD the insertion point is the lower left corner position of the outer edge of the bitmap.
I then think that we must compensate 1/2 of a pixel size in X and Y.
The pixel size is given by A and E (for D=B=zero)

When D or B are non-zero the pixel width is given by: sqrt(A²+D²)
(It should read 'D and B' otherwise the pixel becomes a parallelogram)
And the pixel height by: sqrt(B²+E²)
Then we need somewhat more math to figure out the corner edge position.
Would be simplified with using uVector and vVector.

Regards,
CVH

Post Reply

Return to “QCAD Suggestions and Feedback”