Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3746 closed bug (fixed)

Not recognizing Shapefile Projection

Reported by: rmercer Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.7.0
Component: Projection Support Version: 1.6.0
Keywords: Shapefile, Projection Cc:
Must Fix for Release: No Platform: Windows
Platform Version: Win XP Awaiting user input: no

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.

Attachments (4)

CaliforniaCounty.zip (21.3 KB ) - added by rmercer 13 years ago.
Shapefile of California Counties, Projection is Albers NAD 83 Meters
QGIS_CACounties_ShapefileProjectionIssue.png (120.2 KB ) - added by rmercer 13 years ago.
QGIS Screenshot Showing Coordinate Space of CA Counties Shapefile
CaliforniaCounties.zip (1.9 KB ) - added by rmercer 13 years ago.
Shapefile of California Counties - Proj is Albers Equal Area Unit Meters
poSD_County.zip (41.1 KB ) - added by rmercer 13 years ago.
Shapefile of California San Diego County - Proj is Albers NAD 83 Unit Meters

Download all attachments as: .zip

Change History (11)

by rmercer, 13 years ago

Attachment: CaliforniaCounty.zip added

Shapefile of California Counties, Projection is Albers NAD 83 Meters

by rmercer, 13 years ago

QGIS Screenshot Showing Coordinate Space of CA Counties Shapefile

comment:1 by aghisla, 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?

by rmercer, 13 years ago

Attachment: CaliforniaCounties.zip added

Shapefile of California Counties - Proj is Albers Equal Area Unit Meters

comment:2 by rmercer, 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.

comment:3 by aghisla, 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?

comment:4 by rmercer, 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.

by rmercer, 13 years ago

Attachment: poSD_County.zip added

Shapefile of California San Diego County - Proj is Albers NAD 83 Unit Meters

comment:5 by anitagraser, 13 years ago

I confirm this problem in 1.6 on Win7. But it has been fixed in my install of r15593 so I'd suggest closing.

comment:6 by aghisla, 13 years ago

Resolution: fixed
Status: newclosed

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.

comment:7 by rmercer, 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!

Note: See TracTickets for help on using tickets.