sortshp(1)
π sortshp(1) β sorting a Shape data set like it's NBD π
okay bestie, gather round, because sortshp is one of those tiny lil tools that's lowkey a whole main character. it lives in the MapServer extended universe, and today we're going to read its manual page together, top to bottom, no skimming. π«Ά
β¨ NAME β¨
sortshp β sort a Shape data set. that's it, that's the vibe. π
β¨ SYNOPSIS β¨
sortshp [ infile outfile item [ascending | descending] | -v]
yes the brackets are doing a lot of work here. iykyk. π
β¨ DESCRIPTION β¨
so here's the tea: sortshp sorts a Shape data set based on a single column, either ascending or descending. one column, that's the whole deal. it supports INTEGER, DOUBLE and STRING column types, so basically whatever your attribute table is serving, it can handle. π
and likeβ¦ why would you even want this? because it's genuinely useful for prioritizing shapes for rendering and/or labeling. β¨
the idea here is that if you know you need to display a certain attribute classed by a certain value, it will be faster for MapServer to access that value if it is at the beginning of the attribute file. yes, the beginning. front of the line. main character position. π
β¨ OPTIONS β¨
infileβ the name of the.shpfile. your input, your moment. πΈoutfileβ the name of the.shp/.shxand.dbffiles to create. notice it makes three files, not one, okay? it's giving overachiever. πitemβ name of the field to sort on. one field. singular. don't get cute. πascending,descendingβ sort order (default:ascending). so if you say nothing, it goes ascending, she's polite like that. π-vβ display mapserver version and build options. icon behavior, honestly. π
β¨ EXAMPLE β¨
ok so this example uses a roads file (roads_ugl) that has a field with road classes in integer format (class1). cute, vintage, we love her.
sortshp roads_ugl roads-sort class1 ascending
(that trailing space after sortshp in the original is a whole aesthetic, we're keeping it, no notes. β¨)
Result: a new Shape data set named roads-sort.shp is created with shapes sorted in ascending order, according to the values in the class1 field. literally sorted, literally slaying. π¦
Figure 1: Attributes Before sortshp β http://mapserver.org/_images/sortshp-before.png π (the "before" era, the awkward phase, we've all been there)
Figure 2: Attributes After sortshp β http://mapserver.org/_images/sortshp-after.png π (the glow-up. the transformation. no cap.)
β¨ SEE ALSO β¨
the whole friend group, fr fr. go say hi. π«Ά
bestie reminder: this page is dated 22 August 2026 and it's for sortshp(1). filing it under "iconic, timeless, will reread". π
k bye, go sort something and eat. π π¦π
π¦ 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