photo attachments for 10

5983
26
09-01-2010 08:24 AM
RO
by
New Contributor
The what's new documents about talk about the ability of 10 to support photo attachments, however I can't find information on doing this either in code or just via the project center.
I've also seen a video showing it.
I'd like to get information on how to do this even in just the project center, any help appreciated.
0 Kudos
26 Replies
YuyingLi
New Contributor II
At 10, you can customize flex viewer to show photos taken with Windows Mobile application that are stored in raster field. If you need sample code feel free to let me know.


Hi Jay,

Can you send me the sample code? I am developing a flex application will need to view and edit the feature class (including the attachment) that are updated using the mobile application.

Thanks,
Yuying
0 Kudos
by Anonymous User
Not applicable
Here's an update to this thread specific to ArcGIS Server and a REST implementation of the Raster data type.

Currently if the attribute data of a feature class contains a "raster" data type and a loaded image within, the REST API doesn't support the "Raster" data type after publishing it to ArcGIS Server.  This has downstream effects for clients dependent on REST like Flex, Silverlight and JavaScript.

Ideally, if you want attachments to get pumped out to the web (in a spatial context) the recommended workflow is to enable attachment editing on the feature class. This type of implementation allows you to store one to many, photos, docs, etc at the feature level.  Moreover, REST supports this.

Here's a good article explaining how the workflow begins.

http://blogs.esri.com/Dev/blogs/arcgisdesktop/archive/2010/12/21/Using-attachments-to-manage-associa...

In short, this is a known issue but efforts are being made to offer REST support for raster data types contained within feature classes.

Regards,
Doug Carroll, ESRI Support Services SDK Team
http://support.esri.com/
0 Kudos
ParagKhatavkar
New Contributor
At 10, you can customize flex viewer to show photos taken with Windows Mobile application that are stored in raster field. If you need sample code feel free to let me know.


Hi Jay,

I am really interested in the script which can display photos from Raster field in the flex application. I really need this for my application. I have already contacted ESRI technical support but he didn't have solution for this. Can you please give me some idea how to view photos from raster field into flex viewer. Thanks a lot in advance.
0 Kudos
ATSIT
by
New Contributor
Hi all,

I�??d like to know is there any way we can load the jpg file to the Raster field in a feature class programmatically by using SQL script or .NET or the SDK...

The problem is we have one feature class in the SDE database with a Raster field, and the Raster field is actually a link to SDE_ras_*, SDE_bnd_*, SDE_blk_* tables.
We can load the jpg into this field by right click on the Raster field and select �??Load�?? in Arc Map or Arc Mobile , but it is a black box for me how the jpg is compressed and stored into the database.

In the Desktop 10 help,
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//006z000000qw000000

there are some example of how to insert a jpg into a raster field in SQL as:
insert into urban_area(name, raster)
VALUES('LightHouse', st_raster::construct('C:\Lighthouse.jpg', NULL, 'compression=JPEG'))

But the example will not be working for the Raster field in the feature class.
0 Kudos
CiprianLazar
New Contributor III

I�??d like to know is there any way we can load the jpg file to the Raster field in a feature class programmatically by using SQL script or .NET or the SDK...

I haven't try to save a jpg to a raster field, but I needed to read one. I used ArcObjects for .NET. The code below works on an ArcGIS Server.
I guess that there's not too much work to adapt the code below for writing the jpg instead of reading it.

using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS;
using ESRI.ArcGIS.Carto;
...
public byte[] GetRasterFieldAsJpg(int objectID, string featureClassName, string rasterFieldName)
        {
            #region ArcObjects License Initialization...
            RuntimeManager.Bind(ProductCode.Server); //** Check server license
            IAoInitialize aoInitialize = new AoInitializeClass();
            if (aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer) != esriLicenseStatus.esriLicenseCheckedOut)
                return null; //** License error
            #endregion

            #region Open the workspace and the feature class...
            // Create the workspace factory and instantiate the workspace.
            IPropertySet propertySet = new PropertySetClass();
            propertySet.SetProperty("SERVER", "192.168.1.1"); //** DataBase server
            propertySet.SetProperty("INSTANCE", "sde:oracle11g:DBName");
            propertySet.SetProperty("DATABASE", "DBName");
            propertySet.SetProperty("USER", "username");
            propertySet.SetProperty("PASSWORD", "password");
            propertySet.SetProperty("VERSION", "SDE.DEFAULT");
            
            Type workspaceFactoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(workspaceFactoryType);
            IWorkspace workspace = workspaceFactory.Open(propertySet, 0);

            // Use the IFeatureWorkspace interface to open the workspace's feature class.
            IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
            IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("SchemaName." + featureClassName);
            #endregion

            #region Get the raster field as a JPG
            IFeature feature = featureClass.GetFeature(objectID);
            if (feature != null)
            {
                IRasterValue rasterValue = feature.get_Value(featureClass.FindField(rasterFieldName)) as IRasterValue;
                if (rasterValue == null)
                    return null;

                IRaster raster = ((IRasterValue)feature.get_Value(featureClass.FindField(rasterFieldName))).Raster as IRaster;
                IRasterExporter rasterExporter = new RasterExporter();
                return rasterExporter.ExportToBytes(raster, "JPG");
            }
            return null;
            #endregion
        }


Good luck!
0 Kudos
ChadCollins3
New Contributor II

I am having partial success with using feature class attachments for photos in ArcPad 10.2 with a Trimble Geo 7X and it's built in camera. I have to access the attachment table in ArcCatalog and insert "RASTER" as the Default CONTENT_TYPE field and insert a value e.g. 15 as the Default DATA_SIZE field. I check the data out via Trimble Positions tools and move to device. Open ArcPad on device, start editing on the feature class with attachment, select a feature and open the Feature Properties window, click on the feature Attachment tab, add attachment record, click on the camera button in this window, take picture, save edits exit ArcPad, check data back into the geodatabase via Trimble Positions, in ArcMap, use the Identify button and click on the feature which I create an attachment record for in ArcMap, it is now listed but not accessible. It is like the image never gets imported into the geodatabase as an attachment.

If you don't put the Default values in as described, ArcPad will error out when taking the picture on the device. Any ideas on how to make this process work? Thanks.

0 Kudos
MaximilianGlas
Esri Contributor

This was a discussion about ArcGIS for Windows Mobile, and this is a complete different product than ArcPad.

So maybe you will be more succeeded in the right community.

0 Kudos