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.

It seems that ArcMap keeps a cache for every layer which contains features data and every time wants to refresh layer or apply a change,uses tis cache.As I found,when ArcMap wants to draw a layer from the scratch,sends this query to geodatabase:

select ObjectId,Shape from "featureClassName" [where "layer definition query expression"]

In editing mode,when using snapping,it seems the features data in this cache are used to determine snapping state while mouse movement.I don't know how ArcMap stores spatial data in this cache,in ESRI shape format or as WKB,But I need to retrive these features data.

Is there any way to retrive feature data of a layer using its cache(layer cache) instead of using IFeatureClass::get_Feature method? .....Maybe my idea isn't right and a layer doesn't have any cache(I don't mean cache which is optional for layers and boosts the speed of layer draw),but I'm almost sure spatial data of layers(map) is stored in ArcMap memory somewhere and ArcMap uses it for its operation like snapping during edit operation.Is there any way to access this part of ArcMap data(if really exists)?

Thanks and Regards


Thanks Kirk,bu I don't want to setup a cache,I want to retrieve data from ArcMap cache.ISpatialCacheManager doesn't offer any method for getting a specific data from it.Let me discuss what I mean in more details.

When I put this code inside my program

//C#

IFeature ipF=ipMyFeatureClassObject.GetFeature(10);

ArcMap issues a select command to geodatabase,let's suppose:

select * from MyFeatureClassTableName Where ObjectId=10

and gives back a record of data.

In edit mode,ArcMap can't use this method to get spatial data and calculate snapping state for features on the map because of time consuming this method has and snapping calculation needs a high speed data retrieve,also because mouse can moves every where on the map and snapping is enabled for any zoom,all these witnesses shows that spatial data must be available somewhere in memory and I'm looking for a method to access it.

If all these consumptions not come true,so there must be a perfect method that ArcMap uses to retrieve spatial data from geodatabase on the fly(for example 4 or 6 level spatial indexing based on the map extent and use the mouse position to retrieve only part of spatial data while mouse movement very fast,in this way only has access to geodatabase when the smallest indexing area of mouse changes).

I'm dealing with developing a tool like "Sketch Tool and "Edit tool" for a data source other than ArcObject data source and I don't want to setup a cache parallel with ArcMap.if possible I want to use same data which ArcMap stores in memory for this data source.

Now,do you guys think these are true consumptions and if yes is there any way to access ArcMap spatial data in its memory?

Best Regards

share|improve this question
1  
If you have built a cache using ISpatialCacheManager, then GetFeature(10) will not issue a Select statement to the database, it will use what is already in memory. In other words caching is transparent. I'd be curious what happens if you cache a large number of features though. –  Kirk Kuykendall Feb 8 '11 at 17:33
1  
Thank you Kirk,if I wan to cache a large number of features,I have 3 choices,1.OnClick tool 2.OnMouseDown 3.OnMouseMove the first 2 choices cause enduser encounters an hourglass mouse pointer for a long time which isn't acceptable for him,the third needs an algorithm which doesn't make any delay in mouse movement for tool,for example a right area around mouse cursor is cached and when cursor goes into another area cache gets refreshed,but I don't know how this mechanism must be implemented,using spatial indexing(like what sqlserver2008 uses) or using ISpatialFilter.Any idea o implement it? –  Reza Feb 11 '11 at 8:48
1  
Please provide more details of your workflow. Perhaps you are trying to provide editing capabilities for a plugindatasource? If not maybe ask this question anyway: "How can I support editing of plugindatasources?" Perhaps this would provide an answer for you. Even though your particular requirements may differ, a more general question would attract more answers. –  Kirk Kuykendall Feb 11 '11 at 15:44
    
Yes Kirk,it's almost true,as you know plugin datasource is readonly and asume I want a toolbar like "Editor" for a plugin datasource or in my own case "OLEDB datasource",because editor toolbar doesn't get enabled for these datasources(and for custom layers too).Just now,I have my tools and extension for "My own editor",but I want to add snapping capability to my tools and for this,I need a cache of all geometries loaded in layers(or at least part of it around mouse cursor),so I don't have to query database while mouse movement.Is there anyway to access ArcMap cache for plugin-oledb features? –  Reza Feb 12 '11 at 7:30

2 Answers 2

up vote 4 down vote accepted
+50

Basically, the Editor extension, when in edit mode, manages a set of snap agents (see ISnapEnvironment). Each of these snap agents may have an associated feature cache (IFeatureSnapAgent.FeatureCache) so that snapping can be done without executing a spatial query every time you move the mouse cursor. So there is not a single feature cache, but typically more of them depending on the number of editable layers and the number of snapping agents turned on.

You may also be able to use the FeatureCache class separately, without the need to work with the Editor.

share|improve this answer
    
Thank you petr,according to EDN help,featurecache is for a small number of features,how ArcMap can do calculation for snapping in edit mode for a large number of features,for example I have more than 5,000 polylines on a layer and even in full extent,ArcMap can still do snapping for vertices and edges? –  Reza Feb 7 '11 at 11:30
1  
The snapping agents usually rebuild their FeatureCache instance each time the mouse leaves the area over which the cache was last built. This keeps the number of features in the cache small. When snapping, there is no caching mechanism other than the IFeatureCache (FeatureCache class) usage. See the Buffer Snap Agent sample: resources.esri.com/help/9.3/ArcGISDesktop/dotnet/… –  Petr Krebs Feb 8 '11 at 12:25
    
Please pay attenion that my datasourse isn't an ArcObject one,so some interfaces which Edior Object implements,I can't use,for example I have to use my own Sketch Tool instead of Editor toolbar's. –  Reza Feb 11 '11 at 8:59
1  
I do understand that, but you can obviously only access ArcObjects data from ArcMap's cache. ArcObjects-based caching mechanisms for non-ArcObjects data are of course not available. Your question sounds that you are creating new non-ArcObjects data (using your own tools), but want to snap to ArcObjects data, leveraging caching like ArcMap does. For that, you CAN work with the editor. But you do not need to all, FeatureCache DOES satisfy your needs if used separately from the editor. –  Petr Krebs Feb 11 '11 at 9:34
1  
If you want to snap to your own non-AO datasource, then please reformulate your question because it is not clear. But if that's the case, caching mechanisms employed by ArcMap for snapping will be useless to you anyway. –  Petr Krebs Feb 11 '11 at 9:35

If you have built a cache using ISpatialCacheManager3 then IFeatureClass.GetFeature should work faster ...

Enabling feature caching improves the performance of all spatial searches whose query geometry lies within the cached area and and also improves the performance of all queries that retrieve features by object ID (for example, GetRow, GetFeature, GetRows, and GetFeatures) ... At ArcGIS release 9.0 and higher, using ISpatialCacheManager does not require an active edit session.

share|improve this answer
    
I added some lines to origin question because of restriction for space in comment seciton.Thanks to all those who participate in this discussion. –  Reza Feb 8 '11 at 11:05

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.