Jump to content
  • Coordinate System Transformation for Image Layers in Spotfire Maps

    The article explains how to transform coordinates from an image into latitude and longitude values for use in Spotfire Map charts. It focuses on applications within the Oil and Gas industry, particularly Source Rock Analysis Studies. The transformation process involves calculating scale and translation factors and then applying these to the coordinates. The article provides step-by-step instructions on implementing this process in Spotfire.



    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



    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


    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

    1. step1.thumb.gif.72b355dbc9f75c1dc0c11e8502fa4a0c.gif Copy and paste the above calibration data table to add it to your Spotfire Analysis  
    2. map.thumb.gif.7b1cf8a32afcfcd784b35a871d7b1ddd.gif Add a Map Chart and delete all the default TMS and Map layers   
    3. imagelayer.thumb.gif.c901d1d713c6ee5091e3645a39647181.gif 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

       Source-Rock-Analysis-Results-of-the-study-wells-A-plot-of-HI-vs-OI-showing-samples-are.png.b574139d4f4289595d96e4424c9fc26c.png   pseudoVanKrevelendiagram.thumb.png.130e4e1e010a707ec126c865206c0bfa.png    kerogen_type.png.51060c1944a1e0f7837526e5cfa7de13.png

    4. df.thumb.gif.4e3bb12ac0d7739f3cba2e4925492ad7.gif  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. 
    5. set_coordinates.thumb.gif.680b1bfe966d987c6dbda57233caacc3.gif Set the Map Chart to use the map_coordinates table and set the positioning to use the lat lon Coordinate columns   
    6. set_params.thumb.gif.592db6b7e664fbbd5add564bfbfadabd.gif 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 
    7. calibrate_point.gif 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. 
    8. set_image.gif Try changing the values for another image

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...