Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top