shptree(1)
π shptree β the glow-up your Shape files deserve π
okay bestie, settle in, because this is the shptree(1) manual page and honestly? it's giving main character energy for your spatial data. no cap.
β¨ NAME β¨
shptree β creates a quadtree-based spatial index for a Shape data set π¦
πΈ SYNOPSIS πΈ
shptree [ shpfile [depth] [index_format] | -v]
π DESCRIPTION π
so what does shptree actually do? it creates a quadtree-based spatial index for a Shape data set. that's the whole vibe. π
the default tree depth gets calculated so that each tree node (aka each quadtree cell) holds 8 shapes. but listen β do not use the default with point files, okay? a value between 6 and 10 seems to work ok. your millage may vary and you'll need to do some experimenting. π
this utility is an absolute must for any MapServer application that uses Shape data sets. shptree creates a spatial index of your Shape data set using a quadtree method, which literally means MapServer will use this index to quickly find the appropriate shapes to draw. iconic behavior, truly. β¨
it creates a file of the same name as your Shape data set, with a .qix file extension. the quadtree method breaks the file into 4 quadrants, recursively, until only a few shapes are contained in each quadrant. and that minimum number? yeah, you can set it with the depth parameter of the command. π«Ά
π OPTIONS π
shpfileβ the name of the.shpfile to index. that's your girl right there.depthβ (Optional) the maximum depth of the index to create. default is0, meaning thatshptreewill calculate a reasonable default depth for you. lowkey magical.index_formatβ (Optional) one of:NLβ LSB byte order, using new index format πNMβ MSB byte order, using new index format π
the following old format options are deprecated π (like, retired, do not use, we moved on):
Nβ Native byte orderLβ LSB (intel) byte orderMβ MSB byte order
the default index_format on this system is: NL
-vβ display mapserver version and build options. a little info dump, as a treat. π
π§ NOTES π§
Shape data sets are native to MapServer, and therefore do not require the .shp extension in the DATA path of the LAYER. in fact β and this is the important part, bestie, so pay attention β in order for MapServer to use the .qix extension you MUST NOT specify the extension. for example:
LAYER
...
DATA "us_states" #MapServer will search for us_states.qix and will use it
...
END
LAYER
...
DATA "us_states.shp" #MapServer will search for us_states.shp.qix and won't find it
...
END
Note: as of MapServer 5.2 the qix will be used even when the .shp extension is specified. glow-up era. π
π₯ EXAMPLE π₯
shptree us_states.shp
creating index of new LSB format
Result:
- A file named
us_states.qixis created in the same location. - (note that you can use the
shptreevis(1)utility to view the actual quadtree quadrants that are used by MapServer in this qix file) β go peek, it's cute. π
π SEE ALSO π
the shptree wiki page at https://github.com/mapserver/mapserver/wiki/ShpTree may also contain information on this utility. iykyk. π¦
and that's the whole page, bestie β this one landed on 22 August 2026, part of the shptree(1) family, and honestly? she ate. slay, shptree(1), periodt. π
β¨π
π¦ where this page comes from
- ubuntu stonking: mapserver-bin 8.6.5-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms