Skip to main content
Solved

EsriPropertyType="PictureX"

  • October 28, 2021
  • 7 replies
  • 40 views

itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • 1442 replies

Hi,

Does anybody have any experience writing GDB metadata images into SDE?

I can update just about anything but inserting an image to the item description needs to be in a specific ESRI binary format (EsriPropertyType="PictureX") and the AttributeFileReader transformer does not support this encoding type.

 

Cheers,

 

Itay

Best answer by david_r

Have you tried converting the binary image file (jpg, probably) contents to Base64 with the BinaryEncoder? 

Not tested, but inspired by the following code found on an Esri forum post.

import xml.etree.ElementTree as ET
import base64
...
with open(jpgFile, "rb") as img_file:
  strEncoded = base64.b64encode(img_file.read()) # Create the needed thumbnail xml element 
  attrib = {'EsriPropertyType':'PictureX'} 
  subEl = ET.SubElement(root,'Binary') 
  subEl = ET.SubElement(subEl,'Thumbnail') 
  subEl = ET.SubElement(subEl,'Data', attrib) 
  subEl.text = strEncoded

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

david_r
Celebrity
  • 8391 replies
  • Best Answer
  • October 28, 2021

Have you tried converting the binary image file (jpg, probably) contents to Base64 with the BinaryEncoder? 

Not tested, but inspired by the following code found on an Esri forum post.

import xml.etree.ElementTree as ET
import base64
...
with open(jpgFile, "rb") as img_file:
  strEncoded = base64.b64encode(img_file.read()) # Create the needed thumbnail xml element 
  attrib = {'EsriPropertyType':'PictureX'} 
  subEl = ET.SubElement(root,'Binary') 
  subEl = ET.SubElement(subEl,'Thumbnail') 
  subEl = ET.SubElement(subEl,'Data', attrib) 
  subEl.text = strEncoded

 


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • 1442 replies
  • October 28, 2021

Have you tried converting the binary image file (jpg, probably) contents to Base64 with the BinaryEncoder? 

Not tested, but inspired by the following code found on an Esri forum post.

import xml.etree.ElementTree as ET
import base64
...
with open(jpgFile, "rb") as img_file:
  strEncoded = base64.b64encode(img_file.read()) # Create the needed thumbnail xml element 
  attrib = {'EsriPropertyType':'PictureX'} 
  subEl = ET.SubElement(root,'Binary') 
  subEl = ET.SubElement(subEl,'Thumbnail') 
  subEl = ET.SubElement(subEl,'Data', attrib) 
  subEl.text = strEncoded

 

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog: 

imageand using python is not an option.


david_r
Celebrity
  • 8391 replies
  • October 28, 2021

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog:

imageand using python is not an option.

The Python code was mostly to show the context.

Are you able to fix the thumbnail in ArcCatalog and export the XML as a template? How does that compare to what you're generating?


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • 1442 replies
  • November 1, 2021

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog:

imageand using python is not an option.

Hi @david_r​ ,

I have done some more investigating and managed to insert the image correctly into the SDE metadata as opposed to previous attempts of replacing the image.


afod
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 18 replies
  • April 21, 2022

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog:

imageand using python is not an option.

Hi itay,

 

I am trying to do the same thing, do you have any information on how you achieved it?

 

Thanks, :)


itay
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • 1442 replies
  • May 10, 2022

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog:

imageand using python is not an option.

As mentioned converting the image into base64 with the BinaryEncoder.


afod
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 18 replies
  • May 10, 2022

Hi @david_r​ ,

Thanks for the tip, unfortunatly the BinaryEncoder does 'something' but the image is not displayed correctly in AcrCatalog:

imageand using python is not an option.

Hmm ok, I've tried that and my blob comes out exactly the same as before no matter what I do. Was there anything else I might be missing?

 

Update: Just figured it out :) thanks!!