Geospatial Queries With Oracle JSON Database

In this article, I want to document how to write geospatial queries against the Oracle Autonomous Database. This example will use the node-oracledb add-on for Node.js and run against an Oracle JSON database. I will not talk about provisioning a JSON database on Oracle Cloud - that will be left as an exercise to the user, if so inclined. This first bit is about setting up the development environment, creating the Node.JS project, and installing the supporting configuration and software required to connect to the remote database.

I was investigating this functionality when building a simple phone application that would show places of interest based on the user's current coordinates. I created a small server-side Node.js application that ran in a Kubernetes cluster hitting an Oracle JSON database. The code presented here is a simplification that just demonstrates API usage. In the application, the user would select the distance from their current position to see all places of interest nearby. What is nice about this example is the code is all on the developer's side (Visual Studio on a Mac) accessing the remote database. This makes it easy to debug and iterate.

CategoriesUncategorized