ThinkGeo.com    |     Documentation    |     Premium Support

Creating a custom index file

I thought I would resurrect this old post seen as we now have the ability to add our own data sources to MapSuite. I would have just replied there... but that forum area is for 2.0 and this post really only applies to MapSuite 3.0:P



I'm creating my own format for storing data (because I need highly compressed data), and i'm obviously facing the need to create an index file that would assist in finding data quickly. I've seen a billion articles on RTree / BTree / QuadTree / Voronoi... even a white paper on the VRTree (Voronoi RTree combination!). This helps my understanding of indices... but not my project plan:P



I've seen hints of RTree usage inside MapSuite. Is there anything I could leverage from MapSuite when creating my own format and index file?



Brendan, 


That’s definitely a challenge to have an efficient, small size index file. Hope you can make it.:)
 
There is some info which might be helpful.  First there is an Open Source project called libgist, which is very powerful (supports different kinds of trees, support multi-dimensions trees I remember, you know Btree is one dimension, Rtree is 2 dimensions), but the code is in C++ and difficult for me to understand. If you have a very good C++ background, you can get it and have a try.
 
A couple things you need to consider. First, what is the type of ID of every record? If it is integer, it’s not big deal as 4 bytes are enough. If it is a string, you should consider if you want to make a max length or you want the length varies. If just for shape file, integer is OK though. Another thing to be aware is that do you need another index for your Rtree index. Why I have this question is that the size of every page is usually fixed. That means there must have some nodes where some space is wasted. If you want it be varies to make it compact, you need another index maybe, like shx to shp.   
 
I’m very interested about your compressing on shp/shx files. I think one way is to change double to float, or even integer, another is to compress it with compression stream, is there any other good ways? :) That will be interesting.
 
Ben