I have a table of locations in which one of the columns represents the lat-long for the location. These coordinates have been extracted from the OpenStreetMap file. How can I create a quadtree index on these coordinates using PostGIS?

  • Why do you want that? – Nicklas Avén Jun 18 '15 at 11:17
  • We are trying to grid the map for a project and want to use quadtree index. – user87407 Jun 18 '15 at 11:19
  • I believe you can do this with the pg-gist extension to Postgres -- but it probably won't be very easy, see: pgcon.org/2011/schedule/attachments/197_pgcon-2011.pdf. It would be reasonably straightforward to write you own, although getting the optimizer to use it would be trickier. – John Powell Jun 18 '15 at 12:53
  • @JohnBarça The link you gave mentions SP-Gist. doxygen.postgresql.org/spgquadtreeproc_8c.html shows that there is an implementation for quadtree in SP-GiST. But I am unable to find a documentation or examples of how to use it for creating index. – user87407 Jun 18 '15 at 13:09
  • There is a link on last page to cs.purdue.edu/spgist. Look at the documents tab. I have never attempted this, it is just something I remember coming across, and not being a C programmer, running away from. – John Powell Jun 18 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.