shptreetst(1)

πŸ’– shptreetst πŸ’–

okay bestie, so shptreetst is the little utility from the shptreetst(1) manual (yeah the manual name is literally right there in the title, it's giving self-titled album energy ✨) and its whole thing is: you run a spatial query on a spatial index that already exists. that's it. that's the gig. 🫢


🌸 NAME 🌸

shptreetst β€” run a spatial query on a spatial index that's already sitting there, existing, living its truth πŸ’…


✨ SYNOPSIS ✨

shptreetst shapefile [minx miny maxx maxy]

πŸ¦‹ DESCRIPTION πŸ¦‹

so shptreetst goes and executes a spatial query on an existing spatial index (that's a .qix file, for the uninitiated πŸŽ€), and that index was made by the shptree(1) utility. no cap.

why would you even want this? because it's genuinely useful for understanding how a search of a Shape data set and its qix index works. like, you get to peek behind the curtain and see the whole thing do its little dance. obsessed. πŸ”₯


πŸ’… OPTIONS πŸ’…

  • shapefile β€” the name of the .shp file index. yes bestie, that's the shapefile we're talking about πŸ“
  • minx miny maxx maxy β€” the extents to render. four lil numbers that say "hey, look here" 🧚

🌈 EXAMPLE 🌈

okay watch this:

shptreetst esp 879827.480246 4317203.699447 884286.289767 4321662.508967

and this is the absolute wall of text it blesses you with (do NOT panic, it's supposed to look like that):

  This new LSB index supports a shapefile with 48 shapes, 4 depth
  shapes 6, node 4, -13702.315770,3973784.599548,1127752.921471,4859616.714055
  shapes 5, node 3, -13702.315770,3973784.599548,614098.064712,4460992.262527
  shapes 1, node 1, -13702.315770,3973784.599548,331587.893495,4241748.814186
  shapes 1, node 0, 141678.278400,3973784.599548,331587.893495,4121164.917599
  shapes 1, node 0, 268807.855447,4193028.047889,614098.064712,4460992.262527
  shapes 1, node 0, 268807.855447,3973784.599548,614098.064712,4241748.814186
  shapes 7, node 4, -13702.315770,4372409.051076,614098.064712,4859616.714055
  shapes 1, node 0, -13702.315770,4372409.051076,331587.893495,4640373.265714
  shapes 3, node 1, -13702.315770,4591652.499417,331587.893495,4859616.714055
  shapes 1, node 0, -13702.315770,4712236.396004,176207.299326,4859616.714055
  shapes 2, node 0, 268807.855447,4372409.051076,614098.064712,4640373.265714
  shapes 3, node 2, 268807.855447,4591652.499417,614098.064712,4859616.714055
  shapes 2, node 0, 424188.449617,4712236.396004,614098.064712,4859616.714055
  shapes 1, node 0, 424188.449617,4591652.499417,614098.064712,4739032.817468
  shapes 2, node 1, 499952.540988,3973784.599548,1127752.921471,4460992.262527
  shapes 2, node 0, 499952.540988,4193028.047889,845242.750254,4460992.262527
  shapes 5, node 3, 499952.540988,4372409.051076,1127752.921471,4859616.714055
  shapes 1, node 1, 499952.540988,4372409.051076,845242.750254,4640373.265714
  shapes 1, node 0, 655333.135158,4372409.051076,845242.750254,4519789.369127
  shapes 1, node 0, 499952.540988,4591652.499417,845242.750254,4859616.714055
  read entire file now at quad box rec 20 file pos 1084
  result of rectangle search was
  8, 10, 36, 37, 38, 39, 42, 46,

πŸ‘‘ Result: πŸ‘‘

okay so the above output from the shptreetst command? let me translate it for you, bestie, because it's actually lowkey iconic πŸ’œ

  • the existing .qix index is for a Shape data set that contains 48 shapes. and yes, the Shape data set used in this example, esp.shp, contains exactly 48 polygons of Spain πŸ‡ͺπŸ‡Έ. main character data set fr fr.
  • the output ALSO tells us that the qix file has a quadtree depth of 4. slay.
  • but here's the part that actually matters most: the resulting shape IDs (or feature IDs, same thing, different name πŸ’«) that were contained in the bounding box that we passed in our example. those got returned at the very bottom of the output: "8, 10, 36, 37, 38, 39, 42, 46". periodt.
  • so you can take a tool like QGIS and go view those feature IDs, and check what shapes MapServer is querying when a user clicks inside that bounding box. that's the whole point. that's the vibe check. πŸŽ€

🫢 SEE ALSO 🫢


ngl the output looks like a glitch but it's not, it's just a quadtree being loud and proud 🌸 don't touch anything, it's working.

and that's the whole page bestie!! this was <rainbow>shptreetst(1)</rainbow> β€” the manual name, right there in the title like it owns the place πŸ‘‘ β€” and the official footer says it's dated 22 August 2026 and it comes from the shptreetst(1) source/version. we love a well-documented queen. mwah πŸ’…βœ¨

πŸ“¦ where this page comes from