Extracting Latitude and Longitude from a Point column
If your data is stored in a database with a column of type POINT
, which represents geographic points, you can extract the latitude and longitude values from this column and create separate dimensions for Latitude and Longitude in Akuko. This guide will walk you through the process step by step.
Prerequisites
Before you start, ensure you have:
- Access to Akuko: You should have an active Akuko account with the necessary permissions to create or modify Dimensions within a Source.
Step 1: Access Your Source
Log in to your Akuko account.
From the Akuko dashboard, navigate to the "Sources" section.
Select the Source where your data with the
POINT
column resides.
Step 2: Cast Point column to string
In the Source settings, navigate to the "Dimensions" section.
Locate the dimension that is stored as a
POINT
in the database.In the calculation or formula section, cast the column to a string using:
ST_AsText(your_point_column)
Step 3: Create Separate Latitude and Longitude Dimensions
In the Source settings, navigate to the "Dimensions" section.
Click on the "Add Dimension" or "Create Dimension" button to initiate the creation process.
Create a new dimension for Latitude. Give it a meaningful name like "Latitude."
For the data type, select the appropriate type for your latitude values, often "Number" or "Decimal."
In the calculation or formula section, use patial functions to extract the Latitude from your
POINT
column. You can use theST_X
function to get the longitude. For example:ST_Y(point_column_name)
Click "Save" or "Create" to save your new Latitude dimension.
Repeat the process to create a new dimension for Longitude. Name it something like "Longitude."
For the data type, select the appropriate type for your longitude values, often "Number" or "Decimal."
In the calculation or formula section, use spatial functions to extract the Longitude from your
POINT
column. You can use theST_X
function for this purpose. For example:ST_X(point_column_name)
Click "Save" or "Create" to save your new Longitude dimension.
Step 4: Utilize Your Latitude and Longitude Dimensions
Your separate Latitude and Longitude dimensions are now available for use within your Source.
You can use these dimensions in various components, including Map components, to visualize geographical data effectively.
Conclusion
Extracting Latitude and Longitude from a POINT
column in a MySQL database allows you to work seamlessly with geographical data in Akuko. These separate dimensions empower you to build interactive maps, perform spatial analysis, and create engaging data stories that incorporate location-based insights.
Explore the possibilities of your newly created Latitude and Longitude dimensions to unlock the full potential of your geographical data within Akuko.