tags:

views:

53

answers:

2

I am embedding the MapControl into a C++ application. The application is tied to a proprietary, non-relational database. Therefore, linking the map control directly to GIS data is not feasible. Instead, I want to simply load my own point features into a Feature layer. I understand the mechanics of creating a Feature layer, but they appear to be tied to a data source of some type. How do I load feature data directly into the layer without pointing to a file or database? In other words, I want these features memory resident only.

+1  A: 

If you only want to display points, don't use a feature layer, but draw directly to the map. Example: here

If your points have associated data, you'll need to load them as features into a feature class (via IFeatureClass.Insert) and attach the feature class to your feature layer. To do this, you'll need to create your own feature class first. Example code here.

Not that this example uses a ShapeFileWorkspaceFactory to create a shapefile on disk to store the features, but in your case you can use a ScratchWorkspaceFactory to create a temp in-memory workspace, flushed when ArcMap closes.

Apologies for the various programming dialects within the links, but I hope they'll give you some starting points to work from.

cfern
MarkerElements is where I started, but the client needs the ability to select and interact with these points. I'll try the ScratchWorkspaceFactory and get back to you. Thanks for the quick response.
KRFournier
Your links helped me get the entirety of my code working as desired, but Kirk's answer was really what I was looking for. I wanted to load points in-memory without a harddrive footprint. The Scratch workspace creates a temporary access database. If I could, I would have made both posts the right answer. Thank you for your quick and thorough response.
KRFournier
+1  A: 

Instead of ScratchWorkspaceFactory, I'd use InMemoryWorkspaceFactory.

You'll still need a featurelayer which will have a reference to the featureclass that resides in the inmemory workspace, as well as the symbology (IGeoFeatureLayer.Renderer) that defines how the information will be symbolized.

Kirk Kuykendall

related questions