Introduction
It is often required to transform the coordinates represented on an image to be used on Spotfire Map charts. Spotfire Maps are very powerful when it comes to Geospatial Data Analysis.
Let's look at some use cases and then I will explain the process of converting the image coordinate system to the Spotfire Map latitude and longitude coordinate so the image layers on the Map Chart can understand and translate accordingly.
For example, in the Oil and Gas industry is common for geologist or petroleum engineers to to do a Source Rock Analysis Study to evaluate the potential for hydrocarbon generation and accumulation to assess their potential for oil or gas production. This is done by analyzing the organic matter in rock samples.
Source Rock Analysis Results Template with different types of kerogen, which is the organic matter in rocks that can generate oil or gas
We want to use this image as a background for a scatter plot. We can achieve this by using the above image as an Image layer on a Spotfire Map chart. We can then use calculated columns, a data function or an expression function to perform the transformation of our X,Y coordinates from our original image to the latitude and longitude corresponding point on our Map chart image layer.
Basically what we need to do is to calculate the scale factors and translate factors and then apply the transformation for these factors.
These equations are used to transform X and Y coordinates to longitude and latitude values, based on the given maximum and minimum values for both dimensions.
Scale Factors:

'scale_x' calculates the scaling factor for the longitude dimension. It is the ratio of the difference between the maximum and minimum longitudes (max_lon  min_lon) to the difference between the maximum and minimum X coordinates (max_X  min_X).
 'scale_y' calculates the scaling factor for the latitude dimension. It is the ratio of the difference between the maximum and minimum latitudes (max_lat  min_lat) to the difference between the maximum and minimum Y coordinates (max_Y  min_Y).
Translation Factors:

'trans_x' calculates the translation factor for the longitude dimension. It is the difference between the minimum longitude and the product of the scaling factor for the longitude dimension and the minimum X coordinate (min_lon  scale_x * min_X).
 'trans_y' calculates the translation factor for the latitude dimension. It is the difference between the minimum latitude and the product of the scaling factor for the latitude dimension and the minimum Y coordinate (min_lat  scale_y * min_Y).
Apply Transformation:

'lon' calculates the transformed longitude value. It is the product of the X coordinate and the scaling factor for the longitude dimension, added to the translation factor for the longitude dimension (X * scale_x + trans_x).

'lat' calculates the transformed latitude value. It is the product of the Y coordinate and the scaling factor for the latitude dimension, added to the translation factor for the latitude dimension (Y * scale_y + trans_y).
# Calculate scale factors scale_x < (max_lon  min_lon) / (max_X  min_X) scale_y < (max_lat  min_lat) / (max_Y  min_Y) # Calculate translation factors trans_x < min_lon  scale_x * min_X trans_y < min_lat  scale_y * min_Y # Apply transformation lon < X * scale_x + trans_x lat < Y * scale_y + trans_y
Requirements
Data
We assume that you have the data points that fits your image. For the previous image, you should have the x values for the oxygen index and the y values for the hydrogen index, but at minimum of 5 data points should be sufficient for any image to calibrate the rest of the points. You should also know the image dimensions in pixels.
Calibration data table
id  X  Y  Description 
1  0  0  origin 
2  100  0  x max 
3  0  1000  y max 
4  100  1000  max boundaries 
5  50  500  center 
Data Function
Either this data function or an Expression Function or the required calculated columns based on the below calculations
transform_to_image_coordinates.sfd
Step by Step Instructions
This step by step instructions can serve as a tutorial to test the provided data function. Please note that the images are intentionally left small so when you click, the screen capture animation is expanded and restarted, so you can see how the step was performed on Spotfire 14
 Copy and paste the above calibration data table to add it to your Spotfire Analysis
 Add a Map Chart and delete all the default TMS and Map layers

Add an Image Layer and choose the image of your choice. You can use the image from above or this other ones (right click download or click first to maximize the image). Click yes if prompted to remove the reference system in all parts of the visualization. Make sure the X,Y low are set to 0 and the X,Y high correspond to the original image dimensions. At this point, you might not see any image on the map. It's ok

Download the data function or import it from Data > Data Function Properties > Register New and enter the values. Start with the column ID as well as the X and Y columns that correspond to the image coordinates. Enter 0 for the rest of the parameters. This data function will generate a new table with the lat lon we need for our Map chart. At this point this generated table is only a placeholder, but we will change the parameters later on to calibrate the points.
 Set the Map Chart to use the map_coordinates table and set the positioning to use the lat lon Coordinate columns
 Configure the proper parameters on for the data function. An easy way to do so is by clicking the fx icon from the Data Table selector from the legend
 You should see four points at the corner of the image. Try changing the value of the original table by editing your Data Table fifth value.
 Try changing the values for another image
Recommended Comments
There are no comments to display.