Menu

Projection and transformation

User Forum
Anonymous
2011-03-13
2023-05-02
  • Anonymous

    Anonymous - 2011-03-13

    Hi every,

    I am trying to transform a layer from Lat/long (decimals) to plane... so i
    will be able to measure distances in metres and not degrees. How can i do
    that? I will be glad if you can tell the tool to use and how to fill the
    parameters. I tried using "coordinate transformation (gird) but i think i i
    didnt do it right, so the ouput is still the same. The layer is a DEM.

    Can any one help? i am new to SAGA, been using ArcMap but wanna taste SAGA a
    bit too:)

     
  • Anonymous

    Anonymous - 2011-03-13

    Hi,

    am afraid that SAGA cannot reproject grids. You can use Quantum GIS and there
    is such tool using GDAL - in main menu Raster. Then you can load transformed
    grid back to SAGA.

     
  • Volker Wichmann

    Volker Wichmann - 2011-03-13

    SAGA is capable to re-project vector and grid datasets.

    First of all, you have to validate that the source coordinate system of your
    data is set. Have a look at the description tab of the dataset you like to
    project (select it in the data tab of the workspace window and then change in
    the object properties window to the description tab).

    In case the description says "Projection: Undefined Coordinate System", you
    can use the 'Projection - Proj.4 / Set Coordinate Reference System' module to
    assign a projection. The 'Get CRS Definition from ...' parameter of the module
    allows you to choose from which information the coordinate description should
    be taken from, either from the 'Proj4 Parameters', the 'EPSG' code or from a
    'Well known Text File'. With either of these choices, you have to provide the
    appropriate information within the corresponding module parameters section. A
    forth option is to use the CRS from a loaded dataset ('Pick CRS from loaded
    data set'). In case you specify either a grid or a shapefile with projection
    information, this information will be used.

    Finally provide the datasets you like to assign the projection information to
    with the module parameters available in the 'Data Objects' section.

    Once you have assigned a coordinate reference system (CRS) to you data, you
    can re-project it with one of the 'Projection - Proj.4 / Coordinate
    Transformation' modules. As you like to re-project a single grid, use the
    'Coordinate Transformation (Grid)' module.

    Again you have to choose from which source the (destination) CRS information
    should be taken - either from the 'Proj4 Parameters', the 'EPSG' code, a 'Well
    known Text File' or from a 'loaded data set'. Provide the necessary
    information within the parameter section of your choice.

    Finally provide the dataset you like to re-project in the 'Data Objects'
    parameter section as 'Source'. Additionally, this section allows to choose an
    interpolation method and whether to determine the output extent automatically
    and allow the user to adjust these settings ('Target - user defined grid
    system') or to use an existing grid system ('Target - existing grid system').

    Volker

     
  • Parag Jyoti Dutta

    Hi Volker,

    There are 2 shapefiles with different CRS—the first one in WGS84/UTM Zone 46N, the second one in WGS84/Web_Mercator_Auxiliary_Sphere. I need to re-project the second one to the CRS of the first one, i.e. WGS84/UTM Zone 46N, such that both shapes occupy the same position on the map.

    If I use the 'Set Coordinate Reference System' module to assign the WGS84/UTM Zone 46N projection to the second shapefile, there seems to be a flaw in its projected Easting and Northing Coordinates. (Note: The projected coordinates are something arbitrary not familiar to me).

    If I use the 'Coordinate Transformation (Shapes)' module, and set the 'Loaded Shapes' parameter to the first shapefile and the 'Data Objects: Source' parameter to the second shapefile to create a new 'Data Objects: Target,' the execution fails.

    I tried searching for any previous solution in this forum, but failed. I am attaching both shapefiles in zipped format. At the same time, I apologize for posting (what might be) a trivial issue here.

    Sincerely,
    PD

     
    • Justus Spitzmüller

      Hi,
      i loaded your two example shapefiles in SAGA, added them to a map and activated the on-the-fly projection. It came my attention that both datasets are roughly 10.000 km apart. This is to much distance for the same UTM zone. With an applied base map the RGI7-Tawang_UTM46N.shp seems correct and i think the other CRS is somehow corrupted.

       
  • Jan Helebrant

    Jan Helebrant - 2022-10-20

    I don't know if it's related but SAGA recently told me about different CRS in case if two layers - both in EPSG:32633 (WGS84 - UTM Zone 33 N) - the grid layer was interpolated in SAGA some time ago - not sure if in the same version (might be older ine) and the polygon layer was from QGIS. Finally, ignoring the warning was OK - both layers were properly overlapped and the processing result was also correct but seems there is an difference in CRS definition which makes SAGA think it is different CRS... Not sure which implementation is wrong there...

    regards

    Jan

     
  • Jan Helebrant

    Jan Helebrant - 2022-10-20
     

    Last edit: Jan Helebrant 2022-10-20
  • mastip

    mastip - 2022-11-21

    Hello I am trying to set coordinate system in batch file. I receive error: wrong authority code. What is wrong with my code? Guys I need help

    REM Tool: Import Raster

    SAGA_CMD io_gdal 0 ^
    -GRIDS="%~dp0\output\%%~ni.sgrd" ^
    -FILES="%~dp0\dane\%%i" ^
    -MULTIPLE=2 ^
    -SELECTION="" ^
    -TRANSFORM=1 ^
    -RESAMPLING=0 ^
    -EXTENT=0

    REM Tool: Set Coordinate Reference System

    SAGA_CMD pj_proj4 0 ^
    -GRIDS="%~dp0\output\%%~ni.sgrd" ^
    -CRS_METHOD=1 ^
    -CRS_EPSG_AUTH=EPSG ^
    -CRS_EPSG=2180 ^
    -SHAPES=file(s)

     
  • mastip

    mastip - 2022-11-21

    This is screen from Windows command line

     
  • Volker Wichmann

    Volker Wichmann - 2022-11-21

    Hi,

    with older SAGA versions like 7.8.2 you required to load the projections dictionary (by passing the flag

    -f=p
    

    to saga_cmd) in order to have access to the projections list and thus to specify an EPSG code. From your script snippet above it seems that you are missing this flag.

    Best regards,
    Volker

     
  • mastip

    mastip - 2022-11-21

    Thank You Volker, It Works, but I have another problem. with gdal transformation grids. I receive following error. pj_obj_create: Cannot find proj.db
    I start saga from OSGeo4W Shell and every environment variable is set.

    This is my part of my code

    call "C:\Program Files\%QGIS_VERSION%\bin\o4w_env.bat"

    REM SET SAGA_TLB=C:\MyTools
    REM SET SAGA_CMD=C:\Program Files\SAGA\saga_cmd.exe

    set "PATH=%PATH%;C:\Program Files\%QGIS_VERSION%\apps\saga"

    @ECHO off

    if exist %~dp0\output rmdir /s /q "%~dp0\output"
    mkdir %~dp0\output

    FOR /F %%i IN ('dir /b %~dp0\dane*.asc') DO (

    REM Tool: Import Raster

    SAGA_CMD io_gdal 0 ^
    -GRIDS="%~dp0\output\%%~ni.sgrd" ^
    -FILES="%~dp0\dane\%%i" ^
    -MULTIPLE=2 ^
    -SELECTION="" ^
    -TRANSFORM=1 ^
    -RESAMPLING=0 ^
    -EXTENT=0

    REM Tool: Set Coordinate Reference System

    SAGA_CMD -f=p pj_proj4 0 ^
    -GRIDS="%~dp0\output\%%~ni.sgrd" ^
    -CRS_METHOD=1 ^
    -CRS_EPSG_AUTH=EPSG ^
    -CRS_EPSG=%EPSG_1%
    rem -SHAPES=file(s)

    REM Tool: Coordinate Transformation (Grid)

    SAGA_CMD -f=p pj_proj4 4 ^
    -CRS_METHOD=1 ^
    -CRS_EPSG=%EPSG_2% ^
    -CRS_EPSG_AUTH=EPSG ^
    -SOURCE="%~dp0\output\%%~ni.sgrd" ^
    -RESAMPLING=3 ^
    -BYTEWISE=0 ^
    -KEEP_TYPE=1 ^
    -TARGET_AREA=0

     
  • mastip

    mastip - 2022-11-21

    Qgis shell settings bellow.

     
  • Volker Wichmann

    Volker Wichmann - 2022-11-21

    The proj.db file is usually located inside the directory that is specified with the PROJ_LIB environment variable. I see that it is set within your QGIS shell settings, but I don't know if the file is available in this path.
    I always recommend to use SAGA natively to prevent running into such problems. It's easy, simply download the ZIP file and run the software from the extracted folder. This should work without problems and without setting any special environment variables (just use a clean shell).
    As I don't know how SAGA is installed on your system, I can't tell if it is as complete install. If it is, it might help to use the proj.db coming with SAGA by setting the PROJ_LIB at the beginning of your script to something like (edit to match your installation):

    SET PROJ_LIB=C:\saga-7.8.2_x64\dll\proj-data
    
     

Log in to post a comment.