Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have Shapefiles without a CRS (e.g. without .prj file).
I would like to set the CRS (EPSG:31468) before I pass the Shapefiles.
I tried the following:

  1. Setting a .prj file manually with the string

    PROJCS["DHDN_3_degree_Gauss_Kruger_zone_4",
        GEOGCS["GCS_DHDN",
            DATUM["D_Deutsches_Hauptdreiecksnetz",
                SPHEROID["Bessel_1841",6377397.155,299.1528128]
            ],
            PRIMEM["Greenwich",0],
            UNIT["Degree",0.017453292519943295]
        ],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",0],
        PARAMETER["central_meridian",12],
        PARAMETER["scale_factor",1],
        PARAMETER["false_easting",4500000],
        PARAMETER["false_northing",0],
        UNIT["Meter",1]
    ]
    
  2. Using ogr2ogr

    ogr2ogr -s_srs EPSG:31468 -t_srs EPSG:31468 out.shp in.shp
    

If I import those shapes into QGIS, QGIS always recognizes CRS EPSG:2167.
I have set in QGIS the correct CRS and exported it in a new file. The .prj of the new file is identical to that one of the input file.
So what's wrong with my files?!

share|improve this question

2 Answers 2

As an observation, you should only need to use -a_srs to override whatever projection the data is in. But that aside, it's a feature/bug in QGIS that it doesn't change the project's CRS when you load new data, you have to specify it manually either by going to Settings|Project Properties... and choosing the CRS you want, or right-clicking on your imported layer and select Set project CRS from layer.

IMO, it would be nice if QGIS defaulted to a "no CRS" and either prompted you for a CRS when you create a new project, or to automatically set the project's CRS from the first data that's loaded. It might be worth raising a feature request with the dev team, but I think this has been discussed before with the resolution that it should remain as is.

share|improve this answer
    
Ok, I take a_srs. For the main question: No I meant something different: The CRS of the loaded shape/layer is recognized as 2167 (independently of the project CRS) even though it is defined as 31468 with ogr2ogr –  user6848 Apr 12 '12 at 9:53
    
Where does it tell you what the layer's CRS is? On my copy of 1.7.0, I can find out the proj4 string in the layer's metadata, and I can see the EPSG code of the project on the right-hand side of the status bar, but that's it. –  MerseyViking Apr 12 '12 at 10:00
    
This time I have the newer version: 1.7.4 ;) EPSG code is shown in Layer-Properties>General>Options or if you choose "Set layer CRS" in the context menu of the layer, the layer CRS is highlighted. –  user6848 Apr 12 '12 at 10:21

Ok, I found in qgis help, that .prj are not adequate to determine the exact projection type. QGIS needs additional .qpj-Files with more information. As I understand, these files are QGIS-specific.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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