TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Geocoding Locations with Turf Mapbox SDK

Implement common Turf functionalities in Java. Use-case + Full Source Code.

Charmaine Chui
TDS Archive
Published in
3 min readNov 23, 2021

Most Geographic Information System (GIS) practitioners who are familiar with Geospatial web applications have encountered the JavaScript utility known as TurfJS, an open-sourced Geospatial Analysis tool. While Turf is known for its versatility and wide array of Geospatial functionalities, 1 of its common use-cases often involves geocoding specific location coordinates within custom boundaries— i.e. Tagging the specific area/region/zone to a target location.

For more in-depth details, please refer to the article below:

To illustrate this functionality, take the country Singapore as an example where the island is divided into 5 separate regionsCentral, North, North-East, East & West.

Illustration by Author | The 5 different regions which Singapore is divided into

In order to tag the correct region which the ❝National Dental Centre (NDC)❞ building resides in, two particular spatial data inputs would be required:

Input (1) The Geometric Polygon/Multi-Polygon features of the 5 regions (assigned as a GeoJSON object in the demo HTML code — boundaries)

Input (2) The building coordinates of the target location — National Dental Centre (assigned as a GeoJSON object in the demo HTML code— targetLocations)

Note: The full HTML code implementation can be found here

Output is as follows:

{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"BLK_NO": "5",
"BUILDING": "NATIONAL DENTAL CENTRE",
"ROAD_NAME": "SECOND HOSPITAL AVENUE",
"POSTAL": "168938",
"REGION_N": "CENTRAL REGION",
"REGION_C": "CR"

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Charmaine Chui
Charmaine Chui

Written by Charmaine Chui

👩‍💻 Data Analyst. Web & Software Developer. Technical Writer✍ | Trying to make the 🌐 better with baby steps👣 [ 📍SG ] LinkedIn@https://tinyurl.com/5h6cufyy

No responses yet

Write a response