Skip to content

Conversation

@danpejobo
Copy link

Describe the bug
The mainBegrensSkade_ImpactMap-method produces incorrect coordinate system for the output raster.

To Reproduce
Steps to reproduce the behavior:

  1. Run the Geovita QGIS plugin
  2. Choose output coordinate system as EPSG:5110
  3. Then run the algorithm Raster information on the produced IMPACT-MAP
  4. Check the output of the Raster information algorithm, or open the "Layer Information" in the Results Viewer
  5. See "cutout" from the error below, which report some errors:

Driver: GTiff/GeoTIFF

Files: C:\Users%userprofile%\Downloads\REMEDY\output\5464577.tif

Size is 35, 36

Coordinate System is:

BOUNDCRS[

SOURCECRS[

    PROJCRS["unknown",

        BASEGEOGCRS["unknown",

            DATUM["Unknown based on GRS 1980 ellipsoid using towgs84=0,0,0,0,0,0,0",

                ELLIPSOID["GRS 1980",6378137,298.257222101004,

                    LENGTHUNIT["metre",1],

Desktop (please complete the following information):

  • OS: Windows
  • QGIS release 3.28L TR

Additional context

This is the code that produces the wrong coordinate system:

# georeference the image and set the projection
outDs.SetGeoTransform(dataset.GetGeoTransform())
#outDs.SetProjection(dataset.GetProjection())
projections = Utils.getProjections()
output_def_desc = projections.get(str(output_proj))
if not output_def_desc:
raise Exception(f"SRID: {output_proj} is not supported")
output_definition = output_def_desc["definition"]["data"]
outDs.SetProjection(output_definition)
outDs.FlushCache()

This pullrequest proposes a change on how the output projection/coord system is set on the output raster.

  1. The input dtb_raster is already in the correct coord sys when the mainBegrensSkade_ImpactMap-method is called
  2. Therefore get the coord system directly from the input raster dataset
  3. Apply it to the output impactmap raster.

This code is ONLY tested on QGIS systems,

Another benefit should be to enable more coord-systems because the code is no longer dependent on the definitions in projections.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant