Adding geospatial support to Sequelize for Node.js

Adding geospatial support to Sequelize for Node.js

Adding geospatial support to Sequelize for Node.jsFarallon was recently asked to support the mapping component of a telecommunications modeling web application. For their server-side framework, the client had already begun development with NodeJS with Express.  For database technology that could handle complex spatial queries and spatial analysis, they chose Postgres/PostGIS. For their
object-relational mapping (ORM), they chose Sequelize. All good or so they thought.

The unanticipated issue, which we quickly discovered once we were brought in on the project,  was that Sequelize did not yet support geometry datatypes. The client was too far into the project to swap technologies and still come in on deadline and on budget, so they asked us for a solution. Fortunately there were several forks of sequalize on github with momentum in the direction of bringing spatial support to sequalize. However, at that time,  which fork(s) would be incorporated into the main repository was uncertain.

As a stop-gap measure, until an existing fork went mainstream, we developed our own forked Sequelize, incorporating and modifying what we needed from other forks, that had been using PostGIS with Sequelize successfully for a couple of months. Obviously the result was interesting to others.  Even before we had submitted our own pull-request with our changes, another Sequelize expert had already recently done this.

In the very near future we will switch our client’s application from our fork to the main Sequelize branch. It’s been a great experience working with Sequelize and given that we are heavy users of PostGIS, I’m sure we will be using it again for future Node projects.

Related articles

FARL_Divider_Graphic-cropped
Deploying ArcGIS Portal and Your First Web Applications with the LGIM
Use your mobile phone to find the best fishing hotspots near you
Port of San Francisco Uses Enterprise GIS to Prepare for Sea Level Rise Caused by Climate Change