mimini Posted September 22, 2015 Share Posted September 22, 2015 I have nearly 2000 maps and a txt file with their names and coordinates of insert points:(:(. I need an lsp which will insert each image into its place.*something like georef* The problem is how to insert image name from txt file and where do i need to place image files. the idea was this: (repeat (length lista) (setq clan (nth brojac lista) x (nth 0 clan) y (nth 1 clan) ime (nth 2 clan) tackaumetanja (list x y) ) (command "_IMAGE" "_ATTACH" ime (tackaumetanja) 1000 0.0)) (setq brojac (+ brojac 1)) Quote Link to comment Share on other sites More sharing options...
jonathann3891 Posted September 22, 2015 Share Posted September 22, 2015 Download this file from my google code https://code.google.com/p/geaux-cad/downloads/detail?name=GeoRefImg.VLX&can=2&q= It is a toolbar that does geo-referenced images. Quote Link to comment Share on other sites More sharing options...
mimini Posted September 22, 2015 Author Share Posted September 22, 2015 (edited) how does it work? i already have the coordinates for placement and image files in txt:geek:... what do i need to do next? it says file not found when i click on image that's inserted. Also i use only plain Autocad Edited September 22, 2015 by mimini Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 23, 2015 Share Posted September 23, 2015 A rescale image lisp you need to have the jpg and a text file jgw for each, insert point is not important use 0,0 ;;;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 » Quote Link to comment Share on other sites More sharing options...
mimini Posted September 23, 2015 Author Share Posted September 23, 2015 But what if i don't have world file. I mean jgw tiff etc. i have only text (.txt) file with two points and scaling for a list of images I am not very familiar with this world thingy :sighs: Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 23, 2015 Share Posted September 23, 2015 This is a JGW sample it matches an individual image JPG. The co-ords are the 262004.647,5773917.244 2.411324381479 0.0 0.0 -2.411324381479 262004.647635524630 5773917.244163344000 Quote Link to comment Share on other sites More sharing options...
mimini Posted September 23, 2015 Author Share Posted September 23, 2015 Thank you Bigal. I'll let you know if i succeed Quote Link to comment Share on other sites More sharing options...
jonathann3891 Posted September 24, 2015 Share Posted September 24, 2015 (edited) After downloading and loading lisp file from above link Start GeoRefImg by typing the GEOREFIMG command. GeoRefImg prompts to select objects (existing images) and then performs the repositioning and scaling controlled by the World files (TFW, TFWx, JGW, JPW, PGW, GFW, BPW, SDW, EWW, WLD...). World files are searched in the folders of the original raster file. The additional command WORLDOUT can create a new world file from an existing positioned image. Rotated images are supported since version 2.5. GEOREFIMG checks the format of the world file and refuses to update images with "suspect" world files. You can control the tolerance (precision) and some of the pre-flight checks: (setq GeoRefCheckTol 0.03) (setq GeoRefCheckIgnore T) Edited September 25, 2015 by jonathann3891 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 25, 2015 Share Posted September 25, 2015 Jonathann add "after downloading and loading lisp file from above link". Quote Link to comment Share on other sites More sharing options...
jonathann3891 Posted September 25, 2015 Share Posted September 25, 2015 Jonathann add "after downloading and loading lisp file from above link". Sorry Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 26, 2015 Share Posted September 26, 2015 No worries got me, went looking for Georefimg, unknown command, thought it may have been something inside MAP. Quote Link to comment Share on other sites More sharing options...
mhy3sx Posted November 3, 2023 Share Posted November 3, 2023 Hi BIGAL. Can you update the code support *.tfw file ? Thanks 5289-4.tfw Quote Link to comment Share on other sites More sharing options...
ronjonp Posted November 3, 2023 Share Posted November 3, 2023 5 minutes ago, mhy3sx said: Hi BIGAL. Can you update the code support *.tfw file ? Thanks 5289-4.tfw 101 B · 0 downloads Try THIS. Quote Link to comment Share on other sites More sharing options...
mhy3sx Posted November 3, 2023 Share Posted November 3, 2023 Hi ronjonp. I try your code but I have a little problem. My template have this settings. All my *.twf export with this settings. My correct *.tfw is 5289-4. For all this file I use https://www.cadstudio.cz/georefimg but ZWCAD don't support *.vlx . Your code is very good but I need a rotation adjustment. Can you fix it? Thanks new export.tfw 5289-4.tfw Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 6, 2023 Share Posted November 6, 2023 I will have to find a JGW but looks the same as a TWF. So try in code. Quote Link to comment Share on other sites More sharing options...
mhy3sx Posted November 12, 2023 Share Posted November 12, 2023 (edited) I find a *jgw file if you want to test the code, But you can test the code with this *.vlx https://www.cadstudio.cz/georefimg if you hace AutoCad Thanks MapSnapshot.jgw Edited November 12, 2023 by mhy3sx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.