vtkGeoTransform and vtkGeoProjection - how the heck to use them?

My vtk-8 C++ app reads GMT grid files that contain latitude/longitude (degrees) and elevation (meters) into a VtkPointArray. I would like to display the data in various map projections, including Universal Transverse Mercator (UTM). The vtkGeoTransform and VtkGeoProjection classes looks like they will do what I need, but I haven’t found any concrete examples that use them. Given my dataset where x and y are longitude-latitude, how exactly do I transform the x-y values to UTM easting and northing?

Some code details below - thanks for your help!

Here is code from my GmtGridReader class:

  // Load points read from grid file
  std::cerr << "GmtGridReader::RequestData() - load points" << std::endl;    
  for (unsigned row = 0; row < gmtGrid_->header->n_rows; row++) {
    for (unsigned col = 0; col < gmtGrid_->header->n_columns; col++) {
      // print debug info
      //      fprintf(stderr, "1) x[%d]: %.8f\n", col, gmtGrid_->x[col]);
      unsigned dataIndex = GMT_Get_Index(gmtApi, gmtGrid_->header, row, col);
      vtkIdType id = gridPoints_->InsertNextPoint(gmtGrid_->x[col],

Here is code that builds the pipeline:

   // The GmtGridReader outputs data as longitude/latitude/elevation
   vtkSmartPointer<mb_system::GmtGridReader> reader =
   // Read the grid file. 
   reader->SetFileName ( filePath.c_str() );
   // Get elevation range for elevation colorizer...
   float zMin, zMax;
   reader->zBounds(&zMin, &zMax);

   // Color data points based on z-value
   vtkSmartPointer<vtkElevationFilter> elevationFilter =

   elevationFilter->SetLowPoint(0, 0, zMin);
   elevationFilter->SetHighPoint(0, 0, zMax);
   // Create renderer
   vtkSmartPointer<vtkRenderer> renderer =

   // Create gridMapper
   vtkSmartPointer<vtkPolyDataMapper> gridMapper =


So where and how exactly do I transform the longitude/latitude values to UTM (easting and northing) values?


In the vtk-examples there is a deprecated example that may be of use GeoGraticle. You can also look in the testing folders of the VTK source, the test is: TestGeoProjection. There may be more tests in VTK 8, most of these classes were deprecated back in 2018. In looking at this GeoVis/Core, I don’t think it has been maintained for long time. This may be of use to you vtklibproj.

1 Like

The gold standard is PROJ, it has lot of prepackaged installers or you can build it yourself. Also the python interface pyproj.