Bug report #3746
Not recognizing Shapefile Projection
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||13805|
I am continually running into an error where I will load a shapefile with an existing, defined projection, into QGIS. QGIS will not recognize the projection that is defined for that shapefile. When you look at the properties for that layer, it shows the default lat/lon WGS 84 projection.
To test this, I opened QGIS. I specified the projection to be WGS 84, and enabled on the fly reprojection of layers.
I then loaded in a shapefile with a defined projection of Albers Equal Area, NAD 83, from the California Teale Data Center. Units are Meters
When loaded, the shapefile appears the coordinate space of a dataset in meters, not in Lat/Lon as it should, given the defined projection.
I have seen this bug brought up before, and it has either been fixed, or closed, or some workaround was created that basically creates a new projection file specifically for QGIS.
Honestly, for software as far along as QGIS, it should be able to recognize a projection if it is already defined. Not realizing that this was happening caused me to create a set of files that were wrong because I saved them to a new file, with a new projection. Since the layer projection was not correct, the reprojection was even further off.
#1 Updated by Anne Ghisla almost 10 years ago
The zip file misses the dbf, and the .shp has a further .xml extension, so I tried to reproduce the problem with my own data.
I set the project CRS as WGS84 and enable OTFR. Then added a shp without projection information, and have been prompted for its CRS. I specified epsg:3003 (italian projection), and the layer's scale and position are transformed values in degrees. Adding another shapefile, with prj, automatically reprojects it to WGS84 in the correct lat/lon place.
In Options dialog > CRS tab, you can select what QGIS should do when the user adds a layer without CRS information. The default is to assign WGS84. That's why, without a prj file, and even if the coordinates are in a projected CRS, QGIS assumes that it is in lat/lon and simply uses the values as they are.
I personally changed the default action to Prompt for CRS - so that I'm notified that there is no projection information and QGIS would hardly guess it.
Can you still upload a valid shapefile for this specific case?
#2 Updated by rmercer - almost 10 years ago
Sorry about the error with the shapefile. I uploaded a new zip that contains all of the necessary files, shp, shx, dbf and a prj file.
I tried what you said, and went into the CRS tab under options and changed it to prompt for a CRS if one is missing. I then closed QGIS completely and opened it again. I added the same layer that I have uploaded, one that I confirm has a valid projection. It still asks me for a CRS
So, the problem is not how it is treating a shapefile that is missing a CRS, it is the fact it does not recognize a shapefile that currently has a CRS.
#4 Updated by rmercer - almost 10 years ago
Well, I finally got the zip file to contain all necessary files. It now will not upload because it is too large for the system to accept it. This is very frustrating for me.
As for simply renaming the prj file and supplying it when prompted for the information. Doesn't that defeat the whole purpose of having a projection already defined for a particular layer?
I am uploading a subset of that shapefile, with the same CRS.
#6 Updated by Anne Ghisla almost 10 years ago
- Status changed from Open to Closed
- Resolution set to fixed
rmercer, can you then upgrade using OSGeo4W and choosing qgis-dev (nightly build of current development version, available in Advanced install).
Feel free to reopen the bug if the problem persists.