ThinkGeo.com    |     Documentation    |     Premium Support

Building indexes

Hi Guys,


I am trying to build an Index file with a different name than the shape file based on a condition.


I am using the following:-
            ShapeFileFeatureSource.BuildIndexFile(“dt_links.shp”,
                                                  “dt_links_cprp",
                                                  "LN_RTID", "<950000",
                                                  BuildIndexMode.Rebuild);
 
This always results in an IOException was unhandled error = “The process cannot access the file because it is being used by another process.”
A TMPdt_route_links_cprp file appears in the folder just before the exception
The index files I am trying to create do not exist, what am I doing wrong?
John
 

John,


First of all, about your problem, I am suspecting there is some another place you are using the dt_links.shp file which has not been closed somehow. So it is reporting some other process are using it. Could you double check this?


Second, about this API, the forth parameter should be a regual expression, following codes shows how to build index for those features with a “land” in its cntry_name.



ShapeFileFeatureSource.BuildIndexFile(@"C:\tmp\Countries02.shp",
                                             @"C:\tmp\Countries02.idx",
                                             "CNTRY_NAME", ".*land",
                                             BuildIndexMode.Rebuild);

Any more questions just feel free to let me know.


Thanks.


Yale