フレクトのクラウドblog re:newal

http://blog.flect.co.jp/cloud/からさらに引っ越しています

AR map base on Twitter tweets

研究開発室の馮 志聖(マイク)です。

Content

  • Introduction
  • ARKit + Core Location + Twitter API
  • Demo
  • Conclusion
  • Other
  • Reference

Introduction

In the era when social media is prevalent, there are various types of content. Some of the content includes location information, such as events, news.... Displaying these location-containing content on the map is convenient for other users to find and read, but they are generally in 2D. Based on flat maps, we will use the latest AR technology combined with 3D maps to present these content including locations, which will bring users a greater experience.

We will develop the Twitter AR map.

Why we choose Twitter?

This chart shows the recent market share of social media in Japan, updated in January 2021.

f:id:fengchihsheng:20210203144724p:plain
Social media stats in Japan until January 2021.

For details, please refer to the link below.

https://gs.statcounter.com/social-media-stats/all/japan

From this chart, we can see that the ratio of Twitter is 59%, nearly half of the market share, so we choose Twitter.

This information get from statcounter GlobalStats.

https://gs.statcounter.com/

The following is a list of libraries we will use:

ARKit

As we all know, ARKit is the core AR technology of ios. It uses the image characteristics of the camera's real-time image and the inertial measurement unit to locate the user's position and render virtual 3D objects.

Core Location

Core Location provides services that determine a device’s geographic location, altitude, and orientation, or its position relative to a nearby iBeacon device.

The framework gathers data using all available components on the device, including the Wi-Fi, GPS, Bluetooth, magnetometer, barometer, and cellular hardware.

ARKit + Core Location

There are already examples of the combination of the two on the Internet. This example will display the map marked in AR and can also navigate us to the destination. We will extend the function of this example.

https://github.com/ProjectDent/ARKit-CoreLocation

Twitter API

The Twitter API allows developers to get the latest tweets. We will use this API to get and send the latest tweets. This API can also filter tweets by GPS location and range.

Note: It must be officially reviewed before using this API.

For details, please refer to the link below.

https://developer.twitter.com/en

ARKit + Core Location + Twitter API

f:id:fengchihsheng:20210203152358p:plain
Overview

First, we must first analyze the response category and structure from the API. The following link is the official documentation.

https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets

We can see sample response information from the description, the following is the data and actual location we want to obtain:

Tweet content

Tweet content can get from statuses[index].text.

GPS location

GPS location can get from statuses[index].geo or statuses[index].coordinates.

Sometimes it only have place information.

Place information have many GPS points.(Like edge points)

So I try to get the center of GPS location by place information.

Place points longitude can get from statuses[index].place.bounding_box.coordinates[0][index][0].

Place points latitude can get from statuses[index].place.bounding_box.coordinates[0][index][1].

User photo

User photo can get from statuses[index].user.profile_image_url_https.

User name

User name can get from statuses[index].user.name.

Created date and time

Created date and time can get from statuses[index].created_at.

Demo

This demo shows the latest tweets within 20 kilometers of my location. I will use this software to send new tweets and display them on this AR map.

f:id:fengchihsheng:20210205175208g:plain
Twitter AR map demo

Conclusion

We have developed this software. It is a great experience for us to see virtual objects in the real world. It is full of a sense of future technology. Maybe flat map information is enough for some people, but I believe this information will be closely related to our lives and give us more convenient services in the future.

Other

Tell us what do you think about our result , or anything else that comes to mind.

We welcome all of your comments and suggestions.

Reference

ARKit
Core Location
ARKit + CoreLocation
Twitter API
statcounter GlobalStats