
Next Post
Carmenta Engine API in PowerShell
Learn how to automate your workflow, creating map configurations using Carmenta Engine’s .NET API from PowerShell.
View Post
When working with geospatial applications, a common operation is to convert between screen pixel coordinates and CRS (coordinate reference system) coordinates, describing real-world locations. This can be useful in various cases, such as displaying the geographical coordinate for the mouse cursor position, working with custom tools for user interaction, editing feature geometries from code, and more.
Transforming coordinates from screen pixel coordinates to the CRS of a specific DataSet is very easy in Carmenta Engine, but it’s important to remember that it must go through the CRS of the View as an intermediary step, because the View is what is drawn on screen.
![]()
With Carmenta Engine, it is very easy to perform these two conversion steps, thanks to these utility methods:
In practice, this is how we can get point coordinates in the DataSet CRS from the pixel coordinates at position (x, y):
Point pixelCoordinates = new Point(x, y);
Point viewCrsCoordinates = myView.PixelToCrs(pixelCoordinates);
Point datasetCrsCoordinates = myView.Crs.ProjectTo(myDataSet.Crs, viewCrsCoordinates);
Point pixelCoordinates(x, y); Point viewCrsCoordinates = myView->pixelToCrs(pixelCoordinates); Point datasetCrsCoordinates = myView->crs()->projectTo(myDataSet->crs(), viewCrsCoordinates);
Which can be summarized into a single line:
Point datasetCrsCoordinates = myView.Crs.ProjectTo(myDataSet.Crs, myView.PixelToCrs(x, y))
Point datasetCrsCoordinates = myView->crs()->projectTo(myDataSet->crs(), myView->pixelToCrs(x, y));
Easy and useful! To go deeper into geographical coordinates, check out these resources:

Learn how to automate your workflow, creating map configurations using Carmenta Engine’s .NET API from PowerShell.
View Post
Create and register custom datasets. Learn how to integrate your own proprietary data reader in Carmenta Engine.
View Post