importing geo-referenced images

Greetings - I am struggling with the insertion of aerial imagery in to our drawing sessions. The imagery has a local coordinate system represented in the world file, which matches the coordinate system of the current drawing. The imagery scale and placement are both off. I have played with the "units" setting without success. I do see the message - "Relative Path can not be assigned," upon launching the command.
Any help would be appreciated, I am attempting to make Bricscad our primary CAD software.

Many thanks,
John Loacker
Kroll Map Company - Seattle

Comments

  • Please note that I have used the command "geographiclocation." Scanning through the list of coordinate systems I am not seeing an exact match, but I have be testing those that are close.
  • Could you possibly post (or include a web link to) your drawing, image, and world file?
  • ALANH
    edited May 2022
    Try this for JGW files.


    ;;;Reads world tiff file (.jgw) to scale and place image correctly in autocad.
    ;;;First insert all tiff images into drawing at whatever scale and insertion point.
    ;;;If the jgw exists in same directory and is named the same as the image selected,
    ;;;it will automatically be found and the image will be scaled and placed. If it is
    ;;;not in the same directory, the user can browse for the file.
    ;;;03.23.2011 Added support to create jgw files as well as support rotated images :)
    ;;;Needs a file with 6 lines (ScaleX Rotation -Rotation -ScaleY TopLeftXCoord TopLeftYCoord)
    ; « Last Edit: April 12, 2011, 09:43:43 am by ronjonp »

    (vl-load-com)
    (defun ss->lst (ss / e n out)
    (setq n -1)
    (while (setq e (ssname ss (setq n (1+ n)))) (setq out (cons (vlax-ename->vla-object e) out)))
    )
    (defun _writefile (filename lst / file result)
    (cond ((and (eq 'str (type filename)) (setq file (open filename "w")))
    (foreach x lst
    (write-line
    (cond ((= (type x) 'str) x)
    ((= (type x) 'int) (itoa x))
    ((= (type x) 'real) (rtos x 2 6))
    ((vl-prin1-to-string x))
    )
    file
    )
    )
    (close file)
    filename
    )
    )
    )
    (defun _readfile (filename / file result)
    (cond
    ((and (eq 'str (type filename)) (setq file (open filename "r")))
    (while (setq line (read-line file)) (setq result (cons (vl-string-trim " " line) result)))
    (close file)
    (reverse result)
    )
    )
    )
    (setq opt "ReadIt")
    ; (initget 0 "ReadIt WriteIt")
    ; (setq opt (cond ((getkword (strcat "\nImage World File [ReadIt/WriteIt] <" opt ">: ")))
    ; (opt)
    ; )
    ; )
    (princ "\nSelect image(s): ")
    (setq pre (getvar 'dwgprefix))
    (if (and (setq ss (ssget '((0 . "image")))) (setq ss (ss->lst ss)))
    (foreach image ss
    (setq name (vlax-get image 'name)
    hgt (vlax-get image 'height)
    wdth (vlax-get image 'width)
    imhgt (vlax-get image 'imageheight)
    imwdth (vlax-get image 'imagewidth)
    rot (vlax-get image 'rotation)
    bpt (vlax-get image 'origin)
    imgpath (vl-filename-directory (vlax-get image 'imagefile))
    jgw (strcat imgpath "\\" name ".jgw")
    )
    (if (= opt "ReadIt")
    (progn
    (if (and (or (setq jgw (findfile (strcat pre name ".jgw")))
    (setq jgw (findfile (strcat imgpath "\\" name ".jgw")))
    (setq jgw (getfiled (strcat "***Select <<" name ".jgw>>***") pre "jgw" 16))
    )
    (setq pre (strcat (vl-filename-directory jgw) "\\"))
    (setq data (mapcar 'atof (_readfile jgw)))
    (> (length data) 5)
    (setq l1 (car data))
    (setq mvpt (list (nth 4 data) (nth 5 data) 0.0))
    )
    (progn (vla-put-imageheight image (* hgt l1))
    (vla-put-imagewidth image (* wdth l1))
    (vla-put-rotation image (cadr data))
    (setq rot (vlax-get image 'rotation))
    (setq bpt (polar bpt (+ (/ pi 2.) rot) (* hgt l1)))
    (vlax-invoke image 'move bpt mvpt)
    (princ (strcat "\njgw File Read - " jgw))
    )
    (princ "\njgw file NOT found or not correctly formatted!")
    )
    )
    (progn (setq bpt (polar bpt (+ (/ pi 2.) rot) imhgt))
    (if (setq jgw (_writefile
    (strcat imgpath "\\" name ".jgw")
    (list (/ imhgt hgt)
    rot
    (strcat "-" (rtos (abs rot) 2 6))
    (strcat "-" (rtos (abs (/ imwdth wdth)) 2 6))
    (rtos (car bpt) 2 6)
    (rtos (cadr bpt) 2 6)
    )
    )
    )
    (print jgw)
    (princ "\nError writing file...")
    )
    )
    )
    )
    )
    (princ)


    (command "draworder" (entlast) "" "B")



    ; « Last Edit: Dec 16 2011 send to back added by alan »
  • Thank you for your time. I have it figured out, and this is another reason to leave ACAD/Raster Design behind. The imagery that I am importing is in Meters, and I need to have that set in a blank drawing before I insert any elements in that are in feet. Evidently I can not change the units to Meters and have it place the image in the proper spatial location while in a drawing with units in feet. This really works, and I appreciate it.
  • A lot of people like to run with it set to 0 = Unitless to avoid any unexpected scaling of inserts, etc.
  • Thanks Terry!
  • jloacker said:

    I do see the message - "Relative Path can not be assigned," upon launching the command.

    This message will be displayed if the drawing hasn't been saved yet. Until the drawing is saved it doesn't have a location to determine a relative path from.

    You will also see this message if the drawing file & image being attached are located on separate drives. In this case it's not possible to create a relative path connection.

    When you run the IMAGEATTACH command, it will automatically find and include a world map file if found. For this to work the filename must match the image, and its extension be named appropriately. It is possible to select the world file related to an image manually if it has been named differently.

    You might like to know that BricsCAD allows you to select multiple images to attach at once with IMAGEATTACH. :smile:

    Regards,
    Jason Bourhill
    BricsCAD V22 Ultimate
    CAD Concepts