Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm having this crazy idea here...Is it possible to store an ESRI object inside a blob field inside a geodatabase? If not, perhaps a serialized XML representation?

I'm thinking about storing IFeatureRenderers inside these fields.

Any tips? Anyone has ever done this?

share|improve this question
add comment

4 Answers 4

up vote 7 down vote accepted

Yes, essentially that is what the Store and retrieve Layers in the GeoDatabase sample does. Haven't seen a .NET port of this though.

In general, as long as the object implements IPeristStream or IPersistVariant, then it can be persisted to a blob in a database.

share|improve this answer
    
I did not know that sample. I'll take a look into it Kirk. Blobs may be better than XML in my opinion. Thanks for the help. looks fairly easy too! –  George Apr 12 '11 at 18:46
    
Forgot to mention the tip: if putting an abstract class in a blob, put it in a propertyset first. Otherwise the deserialization process needs to know what the progid is. This would apply to IFeatureRenderer as well as ILayer instances. –  Kirk Kuykendall Apr 13 '11 at 14:58
add comment

Yes, you can safely persist feature renderers to a blob. In fact, I did exactly that in one of my past projects.

Would probably not work easily for XML since there might be objects in the object graph which do not support XML serialization.

share|improve this answer
    
this is a important comment. I will definetely go the blob route. It's even better because I can save a whole bunch of other information, such as labelling information. –  George Apr 12 '11 at 19:03
add comment

Many objects that do not implement IXmlSerialize can still be serialized to XML. Those objects will simply contain a Base64-encoded string of the binary serialization. Not really efficient or ideal, but useful if you have a need for some objects to be persisted to a human readable.

share|improve this answer
add comment

The IServerContext has a SaveObject and LoadObject method. This lets you save arcObjects as a string and then load it back up when you want it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.