Bug report #3746

Not recognizing Shapefile Projection

Added by rmercer - about 13 years ago. Updated about 13 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Projection Support
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

Description

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.

CaliforniaCounty.zip - Shapefile of California Counties, Projection is Albers NAD 83 Meters (21.3 KB) rmercer -, 2011-04-16 02:08 AM

QGIS_CACounties_ShapefileProjectionIssue.png - QGIS Screenshot Showing Coordinate Space of CA Counties Shapefile (120 KB) rmercer -, 2011-04-16 02:17 AM

CaliforniaCounties.zip - Shapefile of California Counties - Proj is Albers Equal Area Unit Meters (1.85 KB) rmercer -, 2011-04-16 12:06 PM

poSD_County.zip - Shapefile of California San Diego County - Proj is Albers NAD 83 Unit Meters (41.1 KB) rmercer -, 2011-04-16 12:49 PM

History

#1 Updated by Anne Ghisla about 13 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 - about 13 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.

#3 Updated by Anne Ghisla about 13 years ago

I'm sorry, but still the zip file misses the dbf...

What happens if you remove (simply renaming is enough) the prj file, and when prompted for CRS you give the needed information?

#4 Updated by rmercer - about 13 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.

#5 Updated by Anita Graser about 13 years ago

I confirm this problem in 1.6 on Win7. But it has been fixed in my install of 7672cbc9 (SVN r15594) so I'd suggest closing.

#6 Updated by Anne Ghisla about 13 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.

#7 Updated by rmercer - about 13 years ago

@anitagraser - Thank you for the confirmation of this problem.

@aghisla - I installed the qgis-dev development version, and will confirm that it now recognizes the projection of a shapefile when loaded in.

Thanks!

Also available in: Atom PDF