Search code examples
node.jspostgissequelize.jsnode-orm2

Nodejs ORM for Postgers spatial indexes (like PostGIS)


Postgres is the DB of choice due to its spatial indexing goodness (top-k-closest-points) using PostGIS or other gists. Looks like Node.js ORMs do not directly support spatial indexing, so which one requires the least amount of hacking for this? Sequelize and node-orm-2 seem to demand some hacking to get it working. Any suggestions?


Solution

  • As of sequelize 3.4.0, Geometry support has been added for postgres. You can use the GEOMETRY datatype in the model definition:

    sequelize.define("point", {
      geom: DataTypes.GEOMETRY
    });