Bug report #5058

Invalid CRS when the newly created shapefile has a different CRS than the project

Added by Jan Jensen over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:master Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:Yes Copied to github as #:14828

Description

Running v1.7.3 'Wroclaw' on 64 bits windows 7 machine.

Using one CRS for my project (WSG-84 UTM 33N EPSG:32633) I figured it would be nice to create a shapefile with polygons in plain WSG84-lat/lon (EPSG:4326). No special reason for it, just a whim. However, the projection of new shapefile projection was a total screwup.

Here's what I find with ogrinfo -summary

Layer name: test1_originalSRS
Geometry: Polygon
Feature Count: 3
Extent: (516090.757943, 7524045.000971) - (716205.736382, 7703464.547432)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_1984",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]

As you can see, the Extent is in what looks like UTM coordinates (and assuming zone 33N they are where I expect them to be). Those coordinates don't mix very well with WGS-84 projection parameters... Using UTM (meters) where you expect degrees will clearly produce bogus.

For your amusement I've uploaded a screenshot of what it looks like when you import the new shapefile into Qgis. That's EPSG:4326 like you've never seen it before!

Additional information: code rev. 00624b3, GDAL/OGR v 1.8.1, postgreSQL client v. 8.3.10, spatiaLite v 2.4.0, QWT v 5.2.1.

qgis_fancycoordinates.PNG - qgis corrupt CRS in shape file (45.7 KB) Jan Jensen, 2012-02-20 07:59 AM

History

#1 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback

as for the previous ticket you filed, please try qgis-dev with osgeo4w, I think also this was already fixed. Thanks.

#2 Updated by Jan Jensen over 9 years ago

Installed qgis v1.7.4, and I get exactly the same error as before.

#3 Updated by Giovanni Manghi over 9 years ago

Jan Jensen wrote:

Installed qgis v1.7.4, and I get exactly the same error as before.

can you test qgis-dev/osgeo4w? it may have been fixed but not backported.

#4 Updated by Giovanni Manghi over 9 years ago

Just tested to create a new polygon shapefile in WGS84 in a EPSG 32633 project, and the result seems fine in qgis-master

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

General:
Storage type of this layer: ESRI Shapefile
Source for this layer: C:/Users/gio/Desktop/teste.shp
Geometry type of the features in this layer: Polygon
The number of features in this layer: 1
Editing capabilities of this layer: Add Features, Delete Features, Change Attribute Values, Add Attributes, Create Spatial Index, Fast Access to Features at ID, Change Geometries
Extents:
In layer spatial reference system units : xMin,yMin -1.21177,-0.0946221 : xMax,yMax -0.228924,0.683721
Layer Spatial Reference System:
+proj=longlat +datum=WGS84 +no_defs

Can you please test qgis-master and see if it works fine for you? Thanks

#5 Updated by Giovanni Manghi over 9 years ago

  • Resolution set to worksforme
  • Status changed from Feedback to Closed

Closing for lack of feedback. Reopen if necessary.

Also available in: Atom PDF