Skip to content

Instantly share code, notes, and snippets.

@Komzpa
Last active May 7, 2021 00:35
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Komzpa/f9e1c241d1d2a27cf5a4f985f646f8a6 to your computer and use it in GitHub Desktop.
Save Komzpa/f9e1c241d1d2a27cf5a4f985f646f8a6 to your computer and use it in GitHub Desktop.
Visualize PostGIS index using Gevel in Postgres 9.6

Visualize PostGIS index using Gevel in Postgres 9.6:

git clone git://sigaev.ru/gevel
cd gevel
git checkout bd8b8b031a8049a6e7c18c00946bfbd99d75d27f
USE_PGXS=1 make
sudo USE_PGXS=1 make install
psql -f /usr/share/postgresql/9.6/contrib/gevel.sql

psql

drop table if exists idx_vis; 
create table idx_vis as (select level, replace(a::text, '2DF', '')::box2d::geometry as geom from gist_print('idx') as t(level int, valid bool, a box2df));

@FxKu
Copy link

FxKu commented Feb 20, 2019

Hey there, I used this to visualize my GiST-Index. Pretty nice. Wanted to do the same for the sp-Gist index. For the prefix it also returns box2df, but the Polygons appear in the center of my test area and are very small. The leaf_value returns geometry but looks empty.

I'm having the feeling that the result of spgist_print can not really be used for displaying it on a map. Tried reading into the source file but I do not understand the decomposition into higher dimensions.

@salahelfarissi
Copy link

Hi,
I tried installing gevel on ubuntu,
USE_PGXS=1 make
gives errors regarding some *.h files,
also am I supposed to install gist_rtree module on top of my database before installing gevel

Thank you for your time.

@Komzpa
Copy link
Author

Komzpa commented Apr 7, 2021

@salahelfarissi please check you're using latest development versions of Postgres or a matching version of gevel. since it's a dev tool you're expected to be able to handle the issues yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment