Solved

How to extract photo attachments from an fgdb esri file?


Badge +7
How to extract photo attachments from an fgdb esri file?
icon

Best answer by kailinatsafe 22 March 2023, 15:51

View original

13 replies

Userlevel 3
Badge +13

Hello @masonb12​, thanks for posting! I believe the photo attachments will be brought in as seperate features in FME. It may be helpful to know how the photos are stored in your FGDB? Are you able to share a sample or a screenshot?

 

I've added some notes below that might be helpful:

  • If the files are stored locally, a FeatureReader can be used to read in the photos!
  • If the files are stored on the web (eg. hyperlink), try using an ImageFetcher transformer.
  • If the photos are stored in BLOB format, use a RasterReplacer transformer
Badge +7

Hello @masonb12​, thanks for posting! I believe the photo attachments will be brought in as seperate features in FME. It may be helpful to know how the photos are stored in your FGDB? Are you able to share a sample or a screenshot?

 

I've added some notes below that might be helpful:

  • If the files are stored locally, a FeatureReader can be used to read in the photos!
  • If the files are stored on the web (eg. hyperlink), try using an ImageFetcher transformer.
  • If the photos are stored in BLOB format, use a RasterReplacer transformer
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]
Userlevel 3
Badge +13
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hey @masonb12​, would you mind re-sharing the image, not sure it attached properly? Sorry! Kailin.

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Sorry, here you go: Let me know if I can provide any additional details, thanks

image

Userlevel 3
Badge +13
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hello @masonb12​, thanks for re-sharing it! No worries at all! So I think in this case, we can use the RasterReplacer to extract the photos. You can add this transformer directly after your reader feature type. Within the transformer you'll need to specify the 'Format' of the raster being extracted (eg. PNG, TIFF, etc) as well as the 'Blob Attribute' itself:

 

RasterReplacerHowToIf you're not sure how to set up the parameters or what they do, I strongly recommend taking a read through the documentation (there is an example you can refer to as well). Let me know if you need a further hand or get stuck on an error! Happy to help, Kailin

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hi Kailin, sorry I must be doing something wrong. 1) in the rasterreplacer I don't see how to use BLOB as a format as it is not in the list of formats in the dropdown. 2) there is an error about the image not being spatial. There are two tables in the fgdb, one for points and the other for attachments. I just chose the attacments.

3) there should be more than one image, thanks Brad

 

image

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

My mistake, the rasterreplacer works very well and I was able to write out all of the jpg images but they were all named the same "output.jpg" . In order to relate the photos back to their points, should they use the globalIDs as names? If so, how are the photos re-named? thanks Brad

image

Userlevel 3
Badge +13
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hello @masonb12​, thanks for the update! Glad to hear you got it working 😀 If you inspect the output of the RasterReplacer in the Visual Preview window > Feature Information. Do you see any alike attributes you could use to join on with the FeatureJoiner? For example, are any of the attributes preserved on the RasterReplacer output you could use?

 

Alternatively, you might be able to do a 1:1 join in the FeatureMerger (assuming all your features and images are organized identically!):

 

image 

Once your features are all joined, you should be able to change the name of the output in the FeatureWriter, by using the dropdown arrow beside the 'Raster File Name' parameter:

 

image 

If you wish to use multiple attributes to create the file name, you can do this in the TextEditor, instead of selecting an Attribute Value. Let me know if you have any other questions! Happy to help, Kailin.

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hi there, I tried changing the parameters in the feature writer and just changed the raster file name in the dropdown list to GLOBALID and now all of the images have their globalid as a name. Thanks for all your help. This works very well.

Brad Mason

 

image

Userlevel 3
Badge +13
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Thanks @masonb12​ for the update! Appreciate it! Best, Kailin.

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hi Kailin, I hope you don't mind a couple more questions regarding next steps for my envisioned workflow. I was thinking that the next step in the process is to copy the fgdb points to a new database in sqlserver. Every week or so, I would like to update the database with any new data. Can the featurewriter create a new database in sqlserver or do I need to create it and then write to it? What do you recommend?

thanks

Brad Mason

Userlevel 3
Badge +13
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]

Hello @masonb12​, of course no problem! When asking a new or unrelated question, I recommend posting a new question to the community (I believe you'll have better feedback this way!).

 

Nonetheless, this sounds like a job for FME's ChangeDetector! This transformer will detect changes between two sets of input features (in this case your new weekly data and your SQL database). We have a few articles on our knowledge base that explain change detection concepts quite well: Updating Databases: Using Change Detection to Set Operation Type.

 

Was the goal to write the JPEG's to SQL Server as well? I just ran a quick test JPEG -> SQL, it looks like we'll need to extract our raster back into a BLOB attribute before writing to SQL Server (we can use a RasterExtractor to do this, or simply don't extract the JPEG on read).

 

The FeatureWriter is able to create a new or write to an existing database!

 

To automate this (weekly), try using FME Server's Scheduling options or Windows Task Scheduler! Happy to help, Kailin.

Badge +7
Hello, thanks for your reply: When I use the fme ESRI feature reader I can see that there is a table of attachments in blob format. Is there a writer that will write out the attachments in jpg format and an ID? Here is a screen shot [image: image.png]
Hi Kailin, our open source mapguide mapping system cannot read photos in sqlserver. They need to be jpegs and linked separately to the points. I think I will need to use the esri global ids to link them together. Your idea about using change detector sounds good to me, but I think it would be safe to just overwrite the file in sqlserver each time, don't you agree?. I will post a new question if I run into problems in the next step. thanks

Reply