ThinkGeo.com    |     Documentation    |     Premium Support

MultipleShapefileFeatureLayer

I'm starting to use the WorldMapKit (and yes, I know there is a forum for that).   The renderers in that package operate on a folder of shapefiles, and read them all into a MultipleShapefileFeatureLayer.    This is done by using a constructor that accepts a wildcard pattern for the shapefiles, and a single filename for an index file that covers the entire set of shapefiles.   The extension of the index is an midx/mids pair, instead of the normal idx/ids pair.


This structure is a problem for us, because of the volume of the deployment, and any one customer is only interested in a single state.   I'm exploring two options.   We are going to deploy one DVD of common world and USA data to all customers, and then state-specific add-on DVD's to individuals.   Having made this decision, I now have questions about the MultipleShapefileFeatureLayer that are more generic than the specific WorldMapKit application, hence posting here:


1) Is an midx/mids pair a "multiple file" version of the idx/ids pair?


2) The second parameter of the two parameter constructor is defined as an index name pattern.   The shapefilename pattern is defined as "??lka40.shp", for instance, and the ?? matches the two state abbreviation, as there is an lka40 file for each state.   But in the WorldMapKit, the index name pattern is just "lka40.midx".   There is only one index for all 50 state shapefiles.   But.....  could I build an idx/ids pair for each state shapefile, and then use "??lka.idx" as the index name pattern?   Can the Multiple FeatureShapefile operate off of multiple index files, as the constructor parameter implies?


3) If the answer to question 2) is yes, then are there performance hits for using multiple index files?   Certainly not when only one shapefile is included, but how about two?  ten?  twenty?


4) The MultipleShapefileFeatureLayer BuildIndex has an overload defined as:  ThinkGeo.MapSuite.Core.MultipleShapeFileFeatureLayer.BuildIndex(string, string, ThinkGeo.MapSuite.Core.BuildIndexMode), where the second parameter is defined as an indexFilenamePattern.  Does this mean that if I call Buildindex with "??lka40.shp" as the shapefile pattern, and "??lka40.idx" as the index file pattern, that I would get a matching index for each shapefile?   Or is that parameter really a little misnamed? 


Is there any documentation on the MultipleShapefileFeatureLayer or MultipleShapefileFeatureSource?


Thanks!


 



I did find a help file lurking in the documentation folder, and it describes the answers to several of my questions.   However, I also tested those same suppositions, and I found that using a pattern for the indices did not work.   Does evertying in the RC1 still work as documented in this area?



Ted,


Thanks for your post!
 
I think if you notice the other usage of MultipleShapeFileFeatureLayer, most of your problem will be solved.
 
Let us take ??lka40.shp as example. There are 2 ways to use it a as MultipleShapeFileFeaureLayer.
 
First way: Multiple shape file vs One midx/mids
This is the way you talked about, but I do not think it is suitable for you because of your special deployment requirement as you said.
 
Second way: Multiple shape file vs Multple midx/ mids
That is to say, one shape file will have one midx/mids as its RTree file, and this way will not cause obvious performance lost.
 
When you build index, you can do as following:
 

MultipleShapeFileFeatureLayer.BuildIndex(@"??lka40.shp","??lka40.midx", BuildIndexMode.DoNotRebuild);

 

Also, when you create a MultipleShapeFileFeatureLayer, you can do it as following:

 



MultipleShapeFileFeatureLayer a = new MultipleShapeFileFeatureLayer(@"??lka40.shp", "??lka40.midx");

In this way, you will have choice to deploy different data to different DVD without changing any codes.


 
I am not sure you get all answers you need with this, if not, do not hesitate to let me know.
 
Thanks
 
Yale

 

I tried creating a MultipleShapefileFeatureLayer using ??lka40.idx (creating the .idx files from MapExplorer), and it did not work.  Is there a difference between a .midx file and a .idx file?    I suspect this is the case, and was my problem. 
  
 Thanks.

Ted, 
  
 I am sorry to say that the data format is different between .idx and .midx, now they are not compatible with each other. 
  
 .idx/.ids is only for ShapeFileFeatureSource and ShapeFileFeatureLayer, this can be created with MapSuiteExplorer. 
  
 .midx/.mids is only for MultipleShapeFileFeatureSource and MultpleShapeFileLayer, this cannot be created with MapSuite Explorer. It can only be created by static API provided above. 
  
 Let me know if you have any problems! 
  
 Thanks. 
  
 Yale 


Yale, 
  
 I have a question related to one of the constructor of MultipleShapeFileFeatureLayer: 
  
 public static void BuildIndex(  
    string multipleShapeFilePattern, 
    string columnName, 
    string regularExpression, 
    string indexFilename 
 ) 
  
 I have various shapefiles with the same structure and I want to display only some in each shapefile. Can you give me an example on how to write the regular expression? For example how would you write the expression to get only the records above a certain value?  
  
 Thank you.

Adolfo,


 
I do not think you can just select part of the shape files from a same structure shape file folder which containing many shape files. We have considered to enhance this feature. Folllowing post(also created by you) talking about this, please take a look if you are interested.
gis.thinkgeo.com/Support/Dis...fault.aspx
 
I am afraid the way now you can do is by move files you want to do into a separate folder.
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale