shp2tile question

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Mon Apr 11 13:01:26 EDT 2005


Don Deskins wrote:
> hello, another newbie question.
>
> My project has large shp files (2 are greater than 1 gig).  My obvious
> solution to the speed problem was to tile the shp files.
>
> After (finally) getting shp2tile compiled, I tried several different option
> combinations and got what were to me unexpected results.  What I expected
> was some kind of world file for each tile and then use shptree to index the
> files.  What I got of course was a series of shp files.

If you just want to index your shapefile then use shptree shapefile.shp

> My questions are as follows:
>
> 1.  How do I figure out how many rows and colums to use in the shp2tile
> program?  The shp file contains approx 54000 shapes.

There is no magic number. If you data is spread evenly over the area
then you can expect row*col tile or about 54000/(row*col) in each tile.
You might have to try some different sizes to get something you are
happy with.

> 2.  If i use the quadtree option, how do I know what value to use?

Pick the number so that is is as large as possible and that you are
displaying most of the records for each map draw. That way you open the
least number of files and you use most all of the objects in each file
you open. Sorry, no magic number.

> 3.  Is there a way to create an index on the shp files that are produced
> with the shp2tile program, so that I do not have to create a layer for each
> shp file?

After you run shp2tile also run:

find /path/to/files -name "*.shp" -exec shptree {} \;
find /path/to/files -name "*.shp" > tileindex.in
tile2ms tileindex.in tileindex
shptree tileindex

and now you can reference you files in a single layer using:
TILEINDEX "tileindex"

-Steve

> 4.  What else am I missing?
>
> Thanks,
>
> Don
>



More information about the mapserver-users mailing list