Author Topic: GEOMAPIMAGE Group Code 310  (Read 387 times)

0 Members and 1 Guest are viewing this topic.

CodeDing

  • Mosquito
  • Posts: 16
GEOMAPIMAGE Group Code 310
« on: July 07, 2021, 06:46:57 PM »
Hey everybody,

I originally posted this in Autodesk forums to no avail. Perhaps better luck here?

I've been poking my head more into the GEOMAPIMAGE entity recently (see Image_1)

But I'm more curious about what's happening behind the scenes. When I get the entity data for this entity I can see a BUNCH of 310 codes (fun fact, you have to use ssget to get the entity, you can not use entsel)...

Code - Auto/Visual Lisp: [Select]
  1. (-1 . <entity>)
  2. (0 . "GEOMAPIMAGE")
  3. (330 . <entity>)
  4. (5 . "102CB73")
  5. (100 . "AcDbEntity")
  6. (67 . 0)
  7. (410 . "Model")
  8. (8 . "Defpoints")
  9. (100 . "AcDbGeoMap")
  10. (70 . 0)
  11. (330 . <entity>)
  12. (10 3.15643e+06 1.709e+06 0.0)
  13. (10 3.16082e+06 1.70912e+06 0.0)
  14. (40 . 5022.49)
  15. (40 . 2879.6)
  16. (280 . 15)
  17. (280 . 0)
  18. (280 . 2)
  19. (10 12.3707 0.0 0.0)
  20. (10 0.0 12.4121 0.0)
  21. (280 . 50)
  22. (280 . 50)
  23. (280 . 0)
  24. (290 . 0)
  25. (90 . 406)
  26. (90 . 232)
  27. (310 . "F0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFE5DCCAFFFFFFFFFFFFFFFFFFFFFFFFFFE5DCCAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEA")
  28. (310 . "FFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF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EAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EE")
  33. .....
  34. ..... ;; <--- a LOT more 310 codes
  35. .....
  36. (90 . 4)
  37. (90 . 8)
  38. (90 . 8)
  39. (10 3.15648e+06 1.70903e+06 0.0)
  40. (10 3.1614e+06 1.70903e+06 0.0)
  41. (10 3.1614e+06 1.71185e+06 0.0)
  42. (10 3.15648e+06 1.71185e+06 0.0)
  43. (90 . 2)
  44. (1 . " 2021 Microsoft Corporation")
  45. (1 . " 2021 TomTom")
  46. (63 . 18)
  47. (40 . 47.9142)
  48. (71 . 2)
  49. (91 . 5)
  50. (14 3.48039 229.225 0.0)
  51. (14 401.52 229.225 0.0)
  52. (14 401.52 1.77451 0.0)
  53. (14 3.48039 1.77451 0.0)
  54. (14 3.48039 229.225 0.0)
  55.  

Does anybody know what these 310 codes are representing? I can not find them in the documentation.
The ActiveX portion mentions that these are embedded images:
https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-97E4C257-86DC-4B0A-BE49-8EDC5864AABD

I am HOPING that this data can be useful in some fashion that it houses the pixel information for the image.
Is this the case?

Any help is appreciated.

Best,
~DD

(P.S.. if it's possible to EMBED an image, like copying one from my local computer, and somebody can tell me how, that would be super-duper)

BIGAL

  • Swamp Rat
  • Posts: 769
  • 30 + years of using Autocad
Re: GEOMAPIMAGE Group Code 310
« Reply #1 on: July 07, 2021, 10:25:17 PM »
Looks like pixel info, if you can get  a debugger open say a jpg should see similar hex code.
A man who never made a mistake never made anything

BIGAL

  • Swamp Rat
  • Posts: 769
  • 30 + years of using Autocad
Re: GEOMAPIMAGE Group Code 310
« Reply #2 on: July 07, 2021, 10:26:26 PM »
Looks like pixel info, if you can get  a debugger open say a jpg should see similar hex code.

Look at Vector image in dcl they need a similar style of data.
A man who never made a mistake never made anything

CodeDing

  • Mosquito
  • Posts: 16
Re: GEOMAPIMAGE Group Code 310
« Reply #3 on: July 08, 2021, 09:46:12 AM »
Thanks BIGAL, but I was hoping for a bit more than "pixel info"! Can anybody elaborate? Ideally it would be nice to get RGB values from these. How might that be possible?

Best,
~DD

VovKa

  • Swamp Rat
  • Posts: 1352
  • Ukraine
Re: GEOMAPIMAGE Group Code 310
« Reply #4 on: July 08, 2021, 02:10:48 PM »
Ideally it would be nice to get RGB values from these. How might that be possible?
actually it is not RGB its RGBA
so split the huge string into 4byte chunks, then convert each hex byte into decimal

CodeDing

  • Mosquito
  • Posts: 16
Re: GEOMAPIMAGE Group Code 310
« Reply #5 on: July 13, 2021, 05:04:28 PM »

Thank you Vovka. I have seen your answer for a couple days and have begun working on an implementation. I have one typed up but it's WAYYY too slow at the moment. I will update when I get something better up and running.

Thank you for your input.

Best,
~DD

BIGAL

  • Swamp Rat
  • Posts: 769
  • 30 + years of using Autocad
Re: GEOMAPIMAGE Group Code 310
« Reply #6 on: July 14, 2021, 03:44:25 AM »
I had a look at this and this seems to do the rgb convert.

Code: [Select]

;; Base to Decimal  -  Lee Mac
;; Converts an number in an arbitrary base to decimal.
;; n - [str] string representing number to convert
;; b - [int] base of input string
;; Returns: [int] Decimal representation of supplied number

(defun LM:base->dec ( n b / l )
    (if (= 1 (setq l (strlen n)))
        (- (ascii n) (if (< (ascii n) 65) 48 55))
        (+ (* b (LM:base->dec (substr n 1 (1- l)) b)) (LM:base->dec (substr n l) b))
    )
)

(setq str "F0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFE5DCCAFFFFFFFFFFFFFFFFFFFFFFFFFFE5DCCAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEA")

(defun c:test ()
(setq x 1)
(setq lst2 '())
(repeat (/ (strlen str) 8)
(setq lst '())
(repeat 4
(setq hex (strcat (substr str x 1)(substr str (setq x (+ x 1)) 1) ))
(setq num (LM:base->dec hex 16))
(setq lst (cons num lst))
(setq x (+ x 1))
)
(setq lst2 (cons (reverse lst) lst2))
)
(princ lst2)
(princ)
)

A man who never made a mistake never made anything

d2010

  • Newt
  • Posts: 180
Re: GEOMAPIMAGE Group Code 310
« Reply #7 on: July 14, 2021, 05:11:04 AM »
Can you upload your-sample.dwg? Please you save as version acAcad2009
before, because:
I need to test inside NanoCad8.exe.
I don~t known the NanoCad8 workfine with this lispcode, on GEOMAPIMAGE.?>
Code: [Select]
(prompt "\nPlease you select GEOMAPIMAGE@entity:");
(entget (car (entsel))
:tongue2:
I have seen your answer for a couple days and have begun working on an implementation.
~DD

« Last Edit: July 14, 2021, 05:16:49 AM by d2010 »

CodeDing

  • Mosquito
  • Posts: 16
Re: GEOMAPIMAGE Group Code 310
« Reply #8 on: July 14, 2021, 09:29:21 AM »
Bigal,

Your code works in theory, but since there are SO MANY 310 codes, the string length becomes outrageous. some hundreds of thousands in string length I believe. I will post my current code below if people want to try to improve themselves lol. (my 'Hex2RGBA' function needs improved the most)


d2010,

I believe the Geomap Imagery only came out in 2014, so I do not believe I can post an older version. Any person who can use the GEO (GEOGRAPHICLOCATION) command, and have the "Geolocation" contextual ribbon appear, will be able to create a Geomap Image.


Current code:
Code - Auto/Visual Lisp: [Select]
  1. (defun LM:base->dec ( n b / l )
  2.     (if (= 1 (setq l (strlen n)))
  3.         (- (ascii n) (if (< (ascii n) 65) 48 55))
  4.         (+ (* b (LM:base->dec (substr n 1 (1- l)) b)) (LM:base->dec (substr n l) b))
  5.     )
  6. )
  7.  
  8. ;; hex - string, of hexadecimal values (no spaces) to convert to RGBA.
  9. ;; returns - list, of RGBA values as ((R G B A) (R G B A) ...) or nil if errors detected.
  10. (defun Hex2RGBA (hex / pos len errMsg rgba return)
  11.   ;; Prep
  12.   (setq pos -1 len (strlen hex))
  13.   ;; Initial Check(s)
  14.   (setq errMsg
  15.     (cond
  16.       ((not (zerop (rem len 8))) "\nHex2RGBA error; Invalid hex string length.")
  17.     );cond
  18.   );setq
  19.   (if errMsg
  20.     (prompt errMsg)
  21.   ;else
  22.     (repeat (/ len 8)
  23.       (setq rgba '())
  24.       (setq return
  25.         (cons
  26.           (reverse
  27.             (repeat 4
  28.               (setq rgba
  29.                 (cons
  30.                   (LM:base->dec
  31.                     (substr hex (setq pos (+ 2 pos)) 2)
  32.                     16
  33.                   );LM
  34.                   rgba
  35.                 );cons
  36.               );setq
  37.             );repeat
  38.           );reverse
  39.           return
  40.         );cons
  41.       );setq
  42.     );repeat
  43.   );if
  44.   (reverse return)
  45. );defun
  46.  
  47. (defun Get310s (e / )
  48.   (mapcar
  49.     'cdr
  50.     (vl-remove-if
  51.       '(lambda (x) (/= 310 (car x)))
  52.       (entget e)
  53.     );vl-remove-if
  54.   );mapcar
  55. );defun
  56.  
  57. (defun c:GEOCOPY ( / gmap gc310 hex rgba)
  58.   (prompt "\nSelect Geomap Image: ")
  59.   (if (and (setq gmap (car (nentsel "\nSelect Geomap Image: ")))
  60.            (eq "GEOMAPIMAGE" (cdr (assoc 0 (entget gmap)))))
  61.     (progn
  62.       (setq gc310 (Get310s gmap))
  63.       (setq hex (apply 'strcat gc310))
  64.       (setq rgba (hex2rgba hex))
  65.       ;; Do stuff with RGBA
  66.       (prompt "\nGEOCOPY Complete.")
  67.     );progn
  68.   );if
  69.   (princ)
  70. );defun
  71.  

Best,
~DD

BIGAL

  • Swamp Rat
  • Posts: 769
  • 30 + years of using Autocad
Re: GEOMAPIMAGE Group Code 310
« Reply #9 on: July 14, 2021, 08:20:08 PM »
Using a mapcar may speed up the read 4 bytes part but dont ask me how.

You may hit the lisp string length ??
« Last Edit: July 14, 2021, 08:23:25 PM by BIGAL »
A man who never made a mistake never made anything

roy_043

  • Water Moccasin
  • Posts: 1876
  • BricsCAD 18
Re: GEOMAPIMAGE Group Code 310
« Reply #10 on: July 15, 2021, 02:23:35 AM »
Instead of creating a very long string you convert each gc 310 portion separately.

BIGAL

  • Swamp Rat
  • Posts: 769
  • 30 + years of using Autocad
Re: GEOMAPIMAGE Group Code 310
« Reply #11 on: July 15, 2021, 08:56:10 PM »
Like roy_043 not tested.

Code: [Select]
change (defun c:test (str )

(foreach x ent
(if ( = (car x) 310)
(test (cdr x)) ; save result somehow
)
)
[code]
A man who never made a mistake never made anything