2

I've created a Custom Projection System in QGIS using the WKT format (see code below). The custom projection using a local grid system and transforms it GDA94 / MGA zone 51.

It works well in QGIS to look at objects in local grid but when I save any object in the local grid system the shape files do not save any .prj file with it.

My questions are:

  1. Why isn't QGIS saving the .prj file?
  2. Is there any way to make QGIS save the .prj file?
  3. Is there anyway to convert the WKT format into a .prj file?

WKT custom projection format below:

DERIVEDPROJCRS["KIMG",
    BASEPROJCRS["GDA94 / MGA zone 51",
        BASEGEOGCRS["GDA94",
            DATUM["Geocentric Datum of Australia 1994",
                ELLIPSOID["GRS 1980",6378137,298.257222101,
                    LENGTHUNIT["metre",1]]],
            PRIMEM["Greenwich",0,
                ANGLEUNIT["degree",0.0174532925199433]]],
        CONVERSION["Map Grid of Australia zone 51",
            METHOD["Transverse Mercator",
                ID["EPSG",9807]],
            PARAMETER["Latitude of natural origin",0,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",123,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",0.9996,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",500000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",10000000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]]]],
    DERIVINGCONVERSION["Affine",
        METHOD["Affine parametric transformation",
            ID["EPSG",9624]],
        PARAMETER["A0",3644436.5789083,
            LENGTHUNIT["metre",1],
            ID["EPSG",8623]],
        PARAMETER["A1",0.864673183966004,
            SCALEUNIT["coefficient",1],
            ID["EPSG",8624]],
        PARAMETER["A2",-0.50301829055297,
            SCALEUNIT["coefficient",1],
            ID["EPSG",8625]],
        PARAMETER["B0",-7394372.03770256,
            LENGTHUNIT["metre",1],
            ID["EPSG",8639]],
        PARAMETER["B1",0.50301829055297,
            SCALEUNIT["coefficient",1],
            ID["EPSG",8640]],
        PARAMETER["B2",0.864673183966004,
            SCALEUNIT["coefficient",1],
            ID["EPSG",8641]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]]]
4
  • About the third question, did you try saving the same WKT string as the name_of_shapefile.prj file? By the way, QGIS version used in the body of the question would be welcome. Commented Aug 16, 2021 at 17:16
  • @GabrielDeLuca - I tried to save the WKT string as a prj file. Qgis still didn't recognise the prj file Commented Aug 17, 2021 at 0:17
  • 2
    I'm testing, QGIS reprojects the layer but marks its CRS as invalid. It appears that for compatibility reasons GDAL/OGR still needs a definition in WKT1 format. I think that over time this will change. For now, it seems to me a better option to reproject the layers that are in the local system to a known system and work there. Commented Aug 17, 2021 at 4:44
  • Thank you for your help - but I need to work between two different systems as some things are in local and some thing are in MGA. I'm currently using 3.18 but I'll update to 3.20 to see if there in any difference. At the moment I'm more than happy that I can get on the fly projection to work. Commented Aug 17, 2021 at 6:59

1 Answer 1

1

Your custom CRS uses a new WKT definition that was introduced in PROJ 5 or 6. The prj file however is a very old format build by ESRI to define frequently used CRS definitions for shapefiles. It might be that there is no equivalent to your compound transverse mercator with affine transformation in the prj syntax.

UPDATE

After some testing I can confirm your problem. Using GDAL on the command line also does not write the CRS information in the output file. Maybe the GDAL-dev mailing list is the right place to adress this issue.

You can put your WKT definition in a file and name it localCRS.wkt, and use that on the command line with -s_srs or -t_srs to get at least reprojections with ogr2ogr and gdalwarp correctly.

1
  • I tried to save it as a geopackage and QGIS did not recognise the projection. Commented Aug 17, 2021 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.