This is an example project to show developers how to use Kinetica WMS, vector tiles, filters, and get/records with React and Openlayers. This project was bootstrapped with Create React App.
ExampleWmsOpenlayers.js - Display Kinetica WMS layer on an OpenLayers map.
ExampleWmsClassbreakOpenlayers.js - Display Kinetica Classbreak WMS layer on an OpenLayers map.
ExampleWmsSpatialFilterOpenlayers.js - Apply a spatial filter to a Kinetica table and render the resulting view using Kinetica WMS on an OpenLayers map
ExampleVtsOpenlayers.js - Display Kinetica VTS layer on an OpenLayers map.
ExampleApp.js - Simple example map application using React components for Kinetica WMS, Kinetica VTS, and Info popup.
KWmsOlLayer.js is a react component used to render Kinetica's WMS layers on an Openlayers map. The code uses the ol/source/ImageWMS
object to make Kinetica WMS requests with basic authentication headers. The requestParams property contains all the necessary parameters for the WMS request. More details about the necessary Kinetica WMS parameters can be found here: Kinetica WMS Documentation
The WMS layer configuration can be found in config.json under property wmsLayer.kineticaSettings
. The kineticaSettings
objects is converted to Kinetica WMS request parameters in KWmsOlLayer.js
KVectorOlLayer.js is a react component used to render Kinetica vector layers on an Openlayers map. The code uses ol/source/VectorTile
and configures the tileLoadFunction to make requests to Kinetica with basic authentication headers. The attributes
request parameter specifies the WKT column and any additional attributes to be included with each tile request. These attributes can then be used for a map's info popup. More details about Kinetica vector tiles can be found here: Kinetica VTS Documentation
The VTS layer configuration can be found in config.json under property vectorLayer.kineticaSettings
. The kineticaSettings
object is converted to Kinetica VTS request parameters in KVectorOlLayers.js.
The applyFilter
function in ExampleApp.js performs a filter on a Kinetica table and creates a view for the WMS or VTS layers to render on the map.
When a user clicks on the map, a map click event fires sending a REST call to Kinetica for the WMS table data using the filterTableByRadius
function in infoPopupHelper.js.
The vector tile layer already contains the table column data in the tiles and can be retrieved from the map using map.forEachFeatureAtPixel
in Map.js
Before running the application you will need to configure it and load the necessary tables into Kinetica. All configurations are done in config.json.
- Set kUrl to the kinetica url i.e. http(s)://localhost:9191
- Set kUser and kPass to a Kinetica user's username and password
- Import the nyctaxi demo data in GAdmin
- Navigate to GAdmin from your browser
- Click Cluster(top panel)
- Click Demo(left side panel)
- Click Load Sample Data(green button under NYC Taxi)
- Import ki_home.us_states.csv into Kinetica with workbench
- Navigate to Kinetica workbench from your browser
- Click on the Files tab on the left
- Click the
+
under the Files tab and select "Upload New File" - Select a folder and upload the ki_home.us_states.csv.
- After the file uploads to workbench, click the "Import" button
- Click the Next button twice to reach the "Destination" step.
- Fill in the schema as ki_home and leave the table name as us_states
- Click the purple Import button.
In the project directory, you can run:
Installs all the necessary node dependencies
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
Note due to an issue in openlayers, this code will not work with openlayers 8. Instead this project uses Openlayers 7. See ImageWMS imageLoadFunction asynchronous loading is broken
npm install [email protected]