Shape File shows in TOC but not on map

515
2
Jump to solution
06-15-2012 08:37 AM
BryanKardisco
New Contributor
I currently have an ArcToc Control and an ArcMap Control.  Where I'm attempting to create a shapefile , have it saved (to disk) , display on the Table-Of-Contents and also on the Map.

Currently, the Line/Polyline/Polygon/Ellipse all are created as proper shape files. They are also added to my TOC Control and show the name - the linestyle and I can properly view the properties (thickness/color/etc).  However, they do not show up on the map initially.

If I go to the TOC and change the line thickness from the default (1) to any higher number it shows.If I change the line style from solid to Dashes , zoom in and zoom out it also shows.

Any idea why this is happening?
0 Kudos
1 Solution

Accepted Solutions
JohnHauck
Occasional Contributor II
Try invalidating the spatial index.

Here is another doc that goes into more detail on working with indexes

View solution in original post

0 Kudos
2 Replies
JohnHauck
Occasional Contributor II
Try invalidating the spatial index.

Here is another doc that goes into more detail on working with indexes
0 Kudos
BryanKardisco
New Contributor
Try invalidating the spatial index.

Here is another doc that goes into more detail on working with indexes


I've tried invalidating the spatial index by doing the following: your suggestion in bold


IPolygon poly = (IPolygon)myAxMap.TrackPolygon();
poly.SpatialReference = mySpatialReference;

IPointCollection p = poly as IPointCollection;

IGeometry geometry = p as IGeometry;
geometry.SpatialReference = mySpatialReference;
((IZaware)geometry).ZAware = false;

string shapeFileURL = CreateShapeFile(p , LayerName); //Where this generates a valid shp file and returns the full file path
AddLayer(shapeFileURL); //Where this creates the ILayer , sets the layer effects and adds it to a group in myTocControl 

((ISpatialIndex)poly).Invaldiate();


Like I said, the layer shows up in the TOC Control (In the proper spot for indexing).  If I close the app I can see the valid ShapeFile.  I've inspected it manually and with the existing ESRI Tools that can be used to look at layers and the like and it's all good.  If I re-open the app it's visible and the indexing is still the same .

Any other ideas?
0 Kudos