Author Topic: Get image in Google Map  (Read 1389 times)

0 Members and 1 Guest are viewing this topic.

Jeremy2

  • Mosquito
  • Posts: 12
Get image in Google Map
« on: January 06, 2022, 11:26:35 AM »
I have an address of a location. I want to open Google Map and have it go to that address. I want the user to pick a window defining a region and I want to extract that image and put in a defined directory. Can this be done it AutoLISP and if so how. Thanks in advance.

d2010

  • Bull Frog
  • Posts: 323
Re: Get image in Google Map
« Reply #1 on: January 06, 2022, 04:02:07 PM »
I need more encrypted that VLX, together win can make EncryptedLisp before VLX
 :knuppel2: You do not see, exists a Mortal Kombat-IIt between all
Programs-Platforms.

Code: [Select]
(fight Win10+Win11 Vs Android+)
(EmacLisp Vs AutoLisp)
(Java+Php+... Vs C#+VB.Net+F#)
(AutoCad+BrisCAd+ProgeCAd+ZwCad... VS Catia+SolidWork+Memetcheck)
(
I hope I do not spam.

« Last Edit: January 07, 2022, 12:09:35 AM by d2010 »

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: Get image in Google Map
« Reply #2 on: January 06, 2022, 04:12:34 PM »
welcome to theswamp Jeremy2

i don't think it's possible to control browser's gui with autolisp
but what is your final goal? what are you going to do with that image?
may be we can find a different approach

Jeremy2

  • Mosquito
  • Posts: 12
Re: Get image in Google Map
« Reply #3 on: January 06, 2022, 05:00:10 PM »
My users clip an image off a map and then store it as a PNG file. This is then brought in as a raster and resized to act as a map in the site plan. I have handled it from the point it is inserted into the drawing but I would like to supply a street address and at least have Google Maps go there for a map to pick.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: Get image in Google Map
« Reply #4 on: January 06, 2022, 05:16:22 PM »
what coordinate system do you use?

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Get image in Google Map
« Reply #5 on: January 06, 2022, 10:52:15 PM »
There is numerous youtubes about this maybe have a google and see if can find suitable.

We were lucky and had direct access to our GIS so could export a JPG image and a georeference file a JGW. The its a simple fix as the jgw holds the world co-ordinates and scale factors so image jumps to correct location.

Code: [Select]
;;;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 »
A man who never made a mistake never made anything

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Get image in Google Map
« Reply #6 on: January 07, 2022, 10:18:36 AM »
Just curious, but have you tried the geolocation tab for bringing those aerials and maps? A coordinate system must be set though. We use them alot.
Civil3D 2020

Jeremy2

  • Mosquito
  • Posts: 12
Re: Get image in Google Map
« Reply #7 on: January 07, 2022, 11:25:53 AM »
what coordinate system do you use?

I'm not a civil guy, I don't know what you mean. WCS coordinates are all I know. I just want to see the map and make a PNG of the area.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: Get image in Google Map
« Reply #8 on: January 07, 2022, 05:01:25 PM »
what coordinate system do you use?

I'm not a civil guy, I don't know what you mean. WCS coordinates are all I know. I just want to see the map and make a PNG of the area.
in case your drawings are based upon a referenced coordinate system then you can use a tool like this http://www.theswamp.org/index.php?topic=47908.0