hi Melanie
to create the index files I use the following macro in ArcCatalog. It creates 
the index files for all shape files in the selected folder when executing it.
 
place it behind a new button in your ArcCatalog tool bar and have fun!
 
cheers
Urs
 
PS: I did not write it myself, fond it in the web somewhere but don't remember 
anymore...
 
---
 
Sub CreateSpatialIndex()
    Dim pGxApp As IGxApplication
    Set pGxApp = Application
    If TypeOf pGxApp.SelectedObject Is IGxObjectContainer Then
        Dim pGxArray As IGxObjectArray
        Set pGxArray = New GxObjectArray
        GetUnIndexedFeatureclasses pGxApp.SelectedObject, _
                                   pGxArray
        Dim l As Long
        For l = 0 To pGxArray.Count - 1
            Dim pGxDS As IGxDataset
            Set pGxDS = pGxArray.Item(l)
            AddSpatialIndex pGxDS.Dataset
        Next l
    Else
        MsgBox "Bitte zuerst einen Ordner in der Baumstruktur selektieren."
    End If
End Sub
 
Sub AddSpatialIndex(pFC As IFeatureClass)
    'ToDo: use an ISchemalock for ArcSDE situations
    Debug.Print "indexing " & pFC.AliasName
    Dim pFldsEdit As IFieldsEdit
    Set pFldsEdit = New Fields
    pFldsEdit.AddField pFC.Fields.Field(pFC.FindField(pFC.ShapeFieldName))
    
    Dim pIndexEdit As IIndexEdit
    Set pIndexEdit = New esriCore.Index
    Set pIndexEdit.Fields = pFldsEdit
    pIndexEdit.Name = "idx_spatial"
    pFC.AddIndex pIndexEdit
End Sub
 
Sub GetUnIndexedFeatureclasses(pGxObjCont As IGxObjectContainer, _
                               pGxArray As IGxObjectArray)
    Dim pEnumGxObj As IEnumGxObject
    Set pEnumGxObj = pGxObjCont.Children
    If Not pEnumGxObj Is Nothing Then
        pEnumGxObj.Reset
        Dim pGxObj As IGxObject
        Set pGxObj = pEnumGxObj.Next
        Do Until pGxObj Is Nothing
            Debug.Print pGxObj.FullName
            If TypeOf pGxObj Is IGxDataset Then
                Dim pGxDS As IGxDataset
                Set pGxDS = pGxObj
                If pGxDS.Type = esriDTFeatureClass Then
                    If Not HasSpatialIndex(pGxDS.Dataset) Then
                        pGxArray.Insert pGxArray.Count, pGxObj
                    End If
                End If
            Else
                If TypeOf pGxObj Is IGxObjectContainer Then
                    GetUnIndexedFeatureclasses pGxObj, pGxArray
                End If
            End If
            Set pGxObj = pEnumGxObj.Next
        Loop
    End If
End Sub
 
Function HasSpatialIndex(pFC As IFeatureClass) As Boolean
    HasSpatialIndex = _
    Not pFC.Indexes.FindIndexesByFieldName(pFC.ShapeFieldName).Next _
    Is Nothing
End Function
 
 
---

________________________________

Von: [email protected] [mailto:[EMAIL PROTECTED] Im Auftrag von mark2atsafe
Gesendet: Donnerstag, 15. März 2007 23:32
An: [email protected]
Betreff: [fme] Re: ESRI shape spatial index



Hi Melanie,
Unfortunately I see no progress on this one. I'm forced to conclude it
just isn't on our list of priorities.

Even for a fellow SFU/UniGIS'er there isn't much more I can do except
add your info to the request so you are contacted if and when it is
implemented. Because you're importing these files into a non-ESRI
application that requires the indexing, I can at least point to your
case as being a very clear user need. 

Regards,

Mark

Mark Ireland, Senior Product Specialist
Safe Software Inc. Surrey, BC, CANADA
support@ http://www.safe.com <http://www.safe.com> 
Solutions for Spatial Data Translation, Distribution and Access

--- In [email protected] <mailto:fme%40yahoogroups.com> , "mwawryk" <[EMAIL 
PROTECTED]> wrote:
>
> It has been two years since this post so I thought I would see if 
> there has been any progress. We are running in to the same problem. 
> The files are being exported to a non-ESRI product that imports 
> shapefiles but needs the SBN and SBX files and we don't want to have 
> to manually process each file. Any headway on having FME create the 
> SBN and SBX files though workbench?
> 
> 
> --- In [email protected] <mailto:fme%40yahoogroups.com> , "Wakeford, David" 
> <david.wakeford@> 
> wrote:
> >
> > 
> > Hi Mark,
> > 
> > Thats fine, no doubt you will let me know if and when you sort this.
> > 
> > Regards
> > 
> > Dave
> > -----Original Message-----
> > From: Mark Ireland [mailto:[EMAIL PROTECTED]
> > Sent: 18 March 2005 00:47
> > To: [email protected] <mailto:fme%40yahoogroups.com> 
> > Subject: RE: [fme] ESRI shape spatial index
> > 
> > 
> > 
> > Hi David,
> > As you'll have seen from everyone eles's reponse, this isn't 
> currently
> > possible in FME.
> > 
> > The enhancement is already filed twice in our system(!) as PR728 and
> > PR2557 - I'll add your info to one of these to see if we can do
> > anything.
> > 
> > Regards,
> > 
> > Mark
> > 
> > Mark Ireland, Product Support Engineer
> > Safe Software Inc. Surrey, BC, CANADA
> > support@ http://www.safe.com <http://www.safe.com> 
> > Solutions for Spatial Data Translation, Distribution and Access
> > 
> > 
> > > -----Original Message-----
> > > From: Wakeford, David [mailto:[EMAIL PROTECTED] 
> > > Sent: Thursday, March 17, 2005 2:02 AM
> > > To: [email protected] <mailto:fme%40yahoogroups.com> 
> > > Subject: [fme] ESRI shape spatial index
> > > 
> > > 
> > > 
> > > 
> > > Hi ,
> > > 
> > > I have a large number of ESRI shape files that that FME 
> > > produces on a weekly basis.
> > > 
> > > The newly produced shape files run relatively slowly until a 
> > > spatial index (.sbx and .sbn ) is added from within ArcView 3x. 
> > > Running these new shape files through ArcView is a tedious 
> > > process and I wondered if anyone out there knows how to add 
> > > the spatial index from within FME / workbench.
> > > 
> > > 
> > > 
> > > David Wakeford
> > > Administration and Systems Manager,
> > > Guernsey Digimap Services,
> > > Guernsey Technical Services, Public Services Department, Old 
> > > Tobacco Factory, La Vrangue, St Peter Port, Guernsey.
> > > GY1 2ET
> > > 
> > > * Tel: +44 (0) 1481 729240
> > > * Fax: +44 (0) 1481 729241
> > > ----------------------------------------------------------
> ---
> > > This e-mail (including attachments) may contain confidential 
> > > and/or privileged information. If received in error, its use 
> > > by you is not authorised and may be unlawful: please notify 
> > > the sender and delete all copies immediately. Emails are also 
> > > susceptible to error, interference and virus and we accept no 
> > > liability for resulting loss or damage. Emails may be 
> > > monitored for compliance purposes and all copyright is reserved.
> > > Thank you
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Get the maximum benefit from your FME, FME Objects, or 
> > > SpatialDirect via our Professional Services team. Visit 
> > > www.safe.com/services for details. 
> > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > Get the maximum benefit from your FME, FME Objects, or 
> SpatialDirect via our
> > Professional Services team. Visit www.safe.com/services for 
> details. 
> > Yahoo! Groups Links
> >
>



 
*** Unser Email-Content-Scanner hat einen unerlaubten Inhalt oder einen Virus 
in 
dem an Sie adressierten Email festgestellt. Der 
Virus oder unerlaubte Inhalt wurde aus dem Email entfernt. Stadt Chur, 
Amt für Telematik 
***
\HTML Active Content:   Found invalid IMG Tag, Found Web-beacon, Object 
Removed: 1 'img'

Reply via email to