Skip to content

sagabob/ThdpGisAppApi

Repository files navigation

LinkedIn


Logo

Thdp GIS API

A Restful Api providing querying services for configured geospatial features
Explore the api »
Explore the web app using the api »

Table of Contents

About the project

A dotnet-core WebApi which provides Restful services on searching geospatial features such as interested points or properties. Currently, querying features by input phrase is implemented.

Built With

This WebApi is designed with domain driven development. Here is the highlight of design patterns and frameworks used in the application

  • MediatoR
    Decouple input query object from its handler, and also decouple again the handler to different feature sources.
  • Mongodb
    Current use Mongodb to store configuration and feature data.
  • WebApi HealthCheck
  • Swagger

Usage

The WebAPi currently has 3 main routes. Please have a look at the api document https://gisapi.tdp-store.info/index.html for more details. The demo webapp using these Api can be accessed here https://giswebapp.tdp-store.info/

1. [get] /api/gisquery/instances
Return a list of query instances configured in the configuration database. The query instance provides the name of the instance, database connection string, database type (0 for Mongodb), queried field and output fields. Here is an example of a query instance for Place Name feature:

{
  "id": "5e647f2b1a67da2a385eecbd",
  "name": "QueryPlaceName",
  "description": "Query PlaceName collection by Name",
  "queryType": 0,
  "queryField": "placeName",
  "mappings": [
    {
      "id": 0,
      "columnType": 0,
      "propertyName": "placeNameId",
      "outputName": "Id"
    },
    {
      "id": 1,
      "columnType": 0,
      "propertyName": "placeName",
      "outputName": "placeName"
    },
    {
      "id": 2,
      "columnType": 0,
      "propertyName": "locality",
      "outputName": "locality"
    },
    {
      "id": 3,
      "columnType": 1,
      "propertyName": "geometry",
      "outputName": "geometry"
    }
  ]  
}

Here is the detail of an instance of the Place Name feature

{
  "_id": "5b418df63d88413b6ca9d918",
  "placeNameId": 1,
  "placeName": "Aberfoyle Courts",
  "locality": "Queenspark",
  "geometry": {
    "type": "MultiPoint",
    "coordinates": [
      [
        172.70793,
        -43.48352
      ]
    ]
  }
}

2. [get] /api/GisQuery/querybytext/{queryName}/{queriedPhrase}/{pageLimit}
The {queryName} is the name of the query instance provided in the first route, in this case is queryName. The {queriedPhrase} is the phrase that you want to search and the pageLimit indicates the number of records we want to get. An example of the Url is /api/gisquery/queryPlaceName/garden/50

3. [get] /api/GisQuery/querybytext/{queryName}/{queriedPhrase}/{pageLimit}/{pageOrder}
An extend of the previous one, {pageOrder} is the page number, starts with 1.

Getting Started

Prerequisites

The current version requires an environment with dotnet-core 3.0. Mongodb is also necessary.

Installation

  1. Clone the repo
  2. Restore solution

Continuous Development Delivery

  • For CI: The solution is built and the docker is deployed to Docker Hub private repository.
    Build Status
  • For CD: The docker is then deployed as a Digital Ocean App.
    Deployment Status

Roadmap

The application will be extended with the following features

  • Query features by coordinates (input long & lat)
  • Add Kubernetes.
  • Add authentication/authorization.

Contact

LinkedIn
Bob Pham - bobpham.tdp@gmail.com