Implementing Tracking Management and Geo-Fencing on Table Store

Background

Scenario

Table Store

Preparation for Building

(1) Activate Table Store

(2) Create an Instance

  • Beta test invitation request: Open a ticket, select”Table Store” > “Product Features and Characteristics” > “Create a Ticket”. The application content is as follows:
  • Question description: Please enter “Apply for SearchIndex beta test invitation”
  • Confidential information: Please enter region + Instance name, for example, Shanghai + myInstanceName

(3) Download SDKs

<dependency>
<groupId>com.aliyun.openservices</groupId>
<artifactId>tablestore</artifactId>
<version>4.8.0</version>
</dependency>
$ go get github.com/aliyun/aliyun-tablestore-go-sdk
$ npm install tablestore@4.1.0

(4) Design a Table

Start Building (Core Code)

(1) Create a Data Table

(2) Create a Data Table Index

(3) Data Import

(4) Data Reading

List<Query> mustQueries = new ArrayList<Query>();
List<String> polygonList = Arrays.asList(//Geo-fencing, no motorcycle area
"30.262348,120.092127",
"30.311668,120.079761",
"30.332413,120.129371",
...
);
String mId = "id00001";
Long timeStart = [2018-11-01timestamp];
Long timeEnd = [2018-11-02timestamp];
GeoPolygonQuery geoPolygonQuery = new GeoPolygonQuery();
geoPolygonQuery.setPoints(polygonList);
geoPolygonQuery.setFieldName("pos");
mustQueries.add(geoPolygonQuery);
TermQuery termQuery = new TermQuery();
termQuery.setFieldName("mId");
termQuery.setTerm(ColumnValue.fromString(request.getmId()));
mustQueries.add(termQuery);
RangeQuery rangeQuery = new RangeQuery();
rangeQuery.setFieldName("timestamp");
rangeQuery.setFrom(ColumnValue.fromDouble(timeStart, true);
rangeQuery.setTo(ColumnValue.fromDouble(timeEnd, false);
mustQueries.add(rangeQuery);
BoolQuery boolQuery = new BoolQuery();
boolQuery.setMustQueries(mustQueries);

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

WLSDM: Monitoring WebLogic JVM Heap, CPU and Garbage Collection Performance

2 Methods For Dealing With Nulls In TypeScript

Ship Qwik this Holiday Season!

Introducing Amazon Monitron — AWS re:Invent 2020

Backup an Elasticsearch index with a Billion documents using Nutanix Objects

Using a Dolly Track in our Game Over cutscene

How Do You Manage So Many Serverless Functions?

Automatic security tests in Jenkins with OWASP ZAP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Cassandra Monitoring Setup Using Open Source Tools

Web log analysis on AWS. Up and running in minutes!

Introduction to Microservices

Install Minio As Service On Linux